gmane.comp.lang.r.general
http://blog.gmane.org/gmane.comp.lang.r.general
hourly11901-01-01T00:00+00:00Gmanehttp://gmane.org/img/gmane-25t.png
http://gmane.org
grided files
http://comments.gmane.org/gmane.comp.lang.r.general/314752
<pre>Dear All,
I have a file the sample of which is attached. I was trying to read the
data and put it in a data frame. For example in this file, I have 1998 snow
depth data and each block of data belongs to one month. Each data point
belongs to a given latitude and longitude (which is in another file). If I
can read this data and put it in some kind of table where I can provided
the index of the latitude and longitude and get the the data that would be
awesome, but it is taking time. I am wondering if have read such a file.
Best,
Alemu
19988
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
19989
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000</pre>Alemu Tadesse2014-10-31T19:12:49converting individual data series to natural log (continuously compounded return)
http://comments.gmane.org/gmane.comp.lang.r.general/314751
<pre>Hi All,
I want to convert my price data into natural log (continuously compounded
return) by using Performance Analytics Package, I am getting the following
error.
rfut = Return.calculate(fut)
Error in checkData(prices, method = "xts") :
Please help me.
With sincere regards,
Upananda
</pre>Upananda Pani2014-10-31T18:24:32lappy and xts get all indexes from a list ?
http://comments.gmane.org/gmane.comp.lang.r.general/314747
<pre>Dear all,
I have a list , and I want to get all indexes ( dates ) of xts objects in one list:
foo<-list(A = xts(seq(2),seq(Sys.Date(),Sys.Date()+2,length.out=2)), B = xts(seq(1),seq(Sys.Date()-2,Sys.Date()-1,length.out=1)) )
$A
[,1]
2014-10-31 1
2014-11-02 2
$B
[,1]
2014-10-29 1
lapply(foo, function(x) index(x)) gives A and B values separately . I want to get one list like :
"2014-10-31" "2014-11-02" "2014-10-29"
Thanks a lot.
</pre>ce2014-10-31T16:44:003D scatterplot and agreement among three methods in the samesubject
http://comments.gmane.org/gmane.comp.lang.r.general/314745
<pre>Dear all,
I use R 3.1.1 for Windows.
I would like to use three-dimensional scatterplots to evaluate the agreement
among 3 laboratory methods in a set of 30 subjects (all subjects was
evaluated with each of the three methods), using a line of best fit (slope
and intercept) and the line of identity.
Moreover, I would like to evaluate the SD of the residual errors (distance
from line of best fit) to assess the disagreement between any method and the
average value among all 3 methods. For this purpose, no single method was
used as a standard to which the other 2 methods would be compared.
The file is:
Id method1method2meth3
1566
2476
38912
...........
298710
30121413
I know that the package "scatterplot3d" is useful for plotting the data, and
also I read the previous post
http://r.789695.n4.nabble.com/Fit-a-3-Dimensional-Line-to-Data-Points-td8635
96.html . However the R square and SD of the residual errors are not
reported in this example.
Any suggestion is we</pre>Mario Petretta2014-10-31T15:31:00lat/log to meter
http://comments.gmane.org/gmane.comp.lang.r.general/314742
<pre>Dear UseRs,Is there a way in R to convert latitude and longitude in degree.minute.second to meter? (e.g. 45'55'')Thankyou very much in Advance,Eliza
[[alternative HTML version deleted]]
</pre>eliza botto2014-10-31T15:22:24Comparing matrices in R - matrixB %in% matrixA
http://comments.gmane.org/gmane.comp.lang.r.general/314730
<pre>A = matrix(1:10,nrow=5)
B = A[-c(1,2,3),];
So
[,1] [,2]
[1,] 1 6
[2,] 2 7
[3,] 3 8
[4,] 4 9
[5,] 5 10
and
[,1] [,2]
[1,] 4 9
[2,] 5 10
I would like to compare A and B in order to find in which rows of A I can
find the rows of B. Something similar to %in% with one dimensional arrays.
In the example above, the answer should be 4 and 5.
I did a function to do it (see it below), it gives me the correct answer
for this toy example, but the excess of for-loops makes it extremely slow
for larger matrices. I was wondering if there is a better way to do this
kind of comparison. Any idea? Sorry if it is a stupid question.
matbinmata<-function(B,A){
res<-c();
rowsB = length(B[,1]);
rowsA = length(A[,1]);
colsB = length(B[1,]);
colsA = length(A[1,]);
for (i in 1:rowsB){
for (j in 1:colsB){
for (k in 1:rowsA){
for (l in 1:colsA){
if(A[k,l]==B[i,j]){res<-c(res,k);}
}
</pre>Charles Novaes de Santana2014-10-31T13:12:08Knitr: how to find out from within a .Rmd file the output type?
http://comments.gmane.org/gmane.comp.lang.r.general/314726
<pre>Hi.
Is there a way how to find out from within a .Rmd file what output format
is generated?
The reason is this: I write a paper in R markdown in RStudio. Sometimes I
generate .html, sometimes .pdf. My paper presents a table of regression
models using stargazer function. I've got the following code in my paper:
```{r, echo=FALSE, message=FALSE, results='asis'}
model2 <- lm(...)
model3 <- lm(...)
model5 <- lm(...)
stargazer(model2, model3, model5,
...,
type="html")
```
Whenever I change the output format from .html do .pdf, I have to change
the line type="html" to type="latex" manually. (The same holds true for
many other functions, e.g. xtable.)
It would be nice to replace the direct declaration with
type=some_knitr_variable
What is the true name of the some_knitr_variable? I was not able to find it
anywhere.
Many thanks for your help.
Best wishes,
Michal
[[alternative HTML version deleted]]
</pre>Michal Kvasnička2014-10-31T11:56:26How to update R without losing packages
http://comments.gmane.org/gmane.comp.lang.r.general/314725
<pre>A solution on the link below provides the steps of updating R without
losing packages in Unix.
http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html
How could I do that on windows 7 platform?
Thanks
</pre>Kuma Raj2014-10-31T11:33:24R 3.1.2 is released
http://comments.gmane.org/gmane.comp.lang.r.general/314723
<pre>The build system rolled up R-3.1.2.tar.gz (codename "Pumpkin Helmet") this morning.
The list below details the changes in this release.
You can get the source code from
http://cran.r-project.org/src/base/R-3/R-3.1.2.tar.gz
or wait for it to be mirrored at a CRAN site nearer to you.
Binaries for various platforms will appear in due course.
For the R Core Team
Peter Dalgaard
These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:
MD5 (AUTHORS) = 23bbd5f6f8060f187cc02a7b84b342b5
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = c1e4c113071453c7832e5d9ecea623eb
MD5 (INSTALL) = 3964b9119adeaab9ceb633773fc94aac
MD5 (NEWS) = 15cc434143e5e9a8ae3d34eead26521c
MD5 (NEWS.0) = bfcd7c147251b5474d96848c6f57e5a8
MD5 (NEWS.1) = eb78c4d053ec9c32b815cf0c2ebea801
MD5 (NEWS.2) = 8e2f4d1d5228663ae598a09bf1e2bc6b
MD5 (NEWS.html) = 561c491e3bf9554c86675b614c85d34c
MD5 (R-latest.tar.gz) = 3af29ec06704cbd08d4b</pre>Peter Dalgaard2014-10-31T10:13:24MLE
http://comments.gmane.org/gmane.comp.lang.r.general/314722
<pre>HiI have a probability mass function similar to pr(N=n)= integral(((2-x)^n)*(exp(ax-2))) - integral (((5-ax)^n)), both integrals are defined over the interval(0,2) with respect to x. I am going to estimate the parameter (a) with method of maximum likelihood estimation. The loglikelihood is : [F log(pr(n))]=lnL where F is the vector of observations and (n) is the vector of input for the defined pmf . Can anybody suggest me the fastest way of getting the MLE?I have tried this program:n<-c(0,1,2,3,4,5,6,7,8)F<-c(0,0,1,3,5,7,8,11,10)loglik<- function(a) {sum(F*log(pr(n)))}re<- maxlik(loglik, start=.5)summary(re)
I don't know how to define the probability mass function ( pr(n) ) in the written program.I would appreciate for any help.Best Regards
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guid</pre>Parvin Dehghani2014-10-31T06:44:10Variable selection from given data
http://comments.gmane.org/gmane.comp.lang.r.general/314720
<pre>Hi,
I am doing quantile regression of y on a set of 15 explanatory variables x1, x2,....x15. I want to run 15 regression models where in the i-th model, y would be regressed on all x variables except x-i. Then I would compare the results. At this point, I donot know how to create the 15 data sets by dropping the individual x variables. Any help to create the corresponding data sets would be appreciated. I am new to R or general coding.
Thanks,
Preetam
[[alternative HTML version deleted]]
</pre>Preetam Pal2014-10-31T06:14:07Dropping variables from data set
http://comments.gmane.org/gmane.comp.lang.r.general/314718
<pre> Hi,
I have 15 variables x1, x2, .... , x15 and I want to create 15 data sets where the i-th data set D-i will be contain all variables except the variable, x-i, for i in 1 to 15. It would be great if someone can help me out with this. I have had very little exposure to R or general coding before this.
Thanks,
Preetam
[[alternative HTML version deleted]]
</pre>Preetam Pal2014-10-31T04:27:18problem with Zenith angle calculation
http://comments.gmane.org/gmane.comp.lang.r.general/314716
<pre>Dea R users,
In the package insol
I was trying to calculate sunzenith angle. I am using two different date
formats as shown below and both give me different results. Comapring the
results from NOAA website the one below is correct.
xx<-JD(ISOdate(2010,10,1,11))
sv=sunvector(xx,lat,lon,tmz)
zenith=sunpos(sv)
azimuth<-zenith[1,1]
zenith<-zenith[1,2]
zenith
[1] 40.18603
However, the one below is not correct. I have several datetimes and either
I have to use loop to separate year, month, day hour to use the one above.
when I try insert a vector of year, month, day, hour the formula above
doesn't work. I wish I know how to do it for several dates correctly using
the one below.
x<-JD(as.POSIXct("2010-10-01 11:00:00",tz="",format="%Y-%m-%d %H:%M:%S"))
sv=sunvector(x,lat,lon,tmz)
zenith=sunpos(sv)
azimuth<-zenith[1,1]
zenith<-zenith[1,2]
zenith
[1] 77.79948
[[alternative HTML version deleted]]
</pre>Alemu Tadesse2014-10-31T00:00:40change default installation of R
http://comments.gmane.org/gmane.comp.lang.r.general/314713
<pre>I have R version 2.15.0 installed in /usr/local/bin, and this is the
default; in other words when I type which R this is the path I get.
I also have installed R into/usr/local/R-3.1.1/. I used ./configure
and then make to install this version. After make, I get the following
error messages:
../unix/sys-std.o: In function `initialize_rlcompletion':
/usr/local/R-3.1.1/src/unix/sys-std.c:689: undefined reference to
`rl_sort_completion_matches'
collect2: ld returned 1 exit status
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory `/usr/local/R-3.1.1/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/usr/local/R-3.1.1/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/usr/local/R-3.1.1/src'
make: *** [R] Error 1
I want to change R-3.1.1 to the default, so that when I type which R, I
get /usr/local/R-3.1.1
To do this I first cd'd into /usr/local/bin and renamed R to R-old_10-30-14
then created a symlink by 'ln -s /usr/local/R-3.1.1/bin R'
but when I type which R, I get 'n</pre>Matthew2014-10-30T20:46:51Setting a class / outcome variable for Weka PrincipalComponents Analysis
http://comments.gmane.org/gmane.comp.lang.r.general/314706
<pre>Hi everyone,
I've relatively new to R, and i'm trying to use it to perform a Principal
Components analysis (PCA)
I've done this using WEKA previously, and now i'm trying to do so using R's
prcomp and princomp (both options would work for me).
One problem i've found is that while WEKA PCA allows us to specify a class
/ outcome variable / column for the dataset, apparently R project (both
prcomp and princomp) don't.
I've read through a number of documents including this
<http://cran.r-project.org/web/packages/HSAUR/vignettes/Ch_principal_components_analysis.pdf>
with limited success, so wanted to raise this question here. How does one
set the class variable when performing a PCA ?
Any advice would be greatly appreciated !
</pre>Suranga Kasthurirathne2014-10-30T16:26:31PCA on stacked raster (multiple bands/ layers) in R
http://comments.gmane.org/gmane.comp.lang.r.general/314705
<pre>Hello community, I need help on how I can perform PCA on stacked raster
(multiple bands/ layers) in R. Does any body have an idea or script? Thanks
John
[[alternative HTML version deleted]]
______________________________________________
R-help< at >r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
</pre>John Wasige2014-10-30T16:06:41How can I merge data with differing length?
http://comments.gmane.org/gmane.comp.lang.r.general/314702
<pre>How can I merge data frame df and "tem" shown below by filling the
head of "tem" with missing values?
a<- rnorm(1825, 20)
b<- rnorm(1825, 30)
date<-seq(as.Date("2000/1/1"), by = "day", length.out = 1825)
df<-data.frame(date,a,b)
tem<- rpois(1095, lambda=21)
Thanks
</pre>Kuma Raj2014-10-30T16:03:11RForcecom VERY SLOW on large data sets
http://comments.gmane.org/gmane.comp.lang.r.general/314699
<pre>I started using RForcecom package to extract data from SalesForce.
It works very well for data sets with ~< 100K records, however
for a data set with ~400K records it becomes VERY SLOW
and export takes ~14h.
For comparison exporting the same table as csv using "report export" in
SalesForce
takes about 1 minute.
Any ideas why? and how to make it faster?
Best regards,
Ryszard
[[alternative HTML version deleted]]
</pre>Ryszard Czermiński2014-10-30T13:10:29How to speed up list access in R?
http://comments.gmane.org/gmane.comp.lang.r.general/314696
<pre>Hello,
I want to do the following: Given a set of (number, value) pairs, I want
to create a list l so that l[[toString(number)]] returns the vector of
values associated to that number. It is hundreds of times slower than
the equivalent that I would write in python. I'm pretty new to R so I
bet I'm using its data structures inefficiently, but I've tried more or
less everything I can think of and can't really speed it up. I have done
some profiling which helped me find problem areas, but I couldn't speed
things up even with that information. I'm thinking I'm just
fundamentally using R in a silly way.
I've included code for the different versions. I wrote the python code
in a style to make it as clear to R programmers as possible. Thanks a
lot! Any help would be greatly appreciated!
Cheers,
Thomas
R code (with two versions depending on commenting):
-----
numbers <- numeric(0)
for (i in 1:5) {
numbers <- c(numbers, sample(1:30000, 10000))
}
values <- numeric(0)
for (i in 1:length(numbers))</pre>Thomas Nyberg2014-10-30T15:17:59Oddity using multcompView package
http://comments.gmane.org/gmane.comp.lang.r.general/314693
<pre>The multcompView has some useful features but I'm sure this isn't
intentional. Excuse the size. This is about the smallest
reproducible example I can do:
require("multcompView")
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4</pre>Patrick Connolly2014-10-30T08:50:00reading data from a web
http://comments.gmane.org/gmane.comp.lang.r.general/314689
<pre>Dear All,
I have data of the format shown in the link
http://www.data.jma.go.jp/gmd/env/data/radiation/data/geppo/201004/DR201004_sap.txt
that I need to read. I have downloaded all the data from the link and I
have it on my computer. I used the following script (got it from web) and
was able to read the data. But, it is not in the format that I wanted it to
be. I want it a data frame and clean numbers.
asNumeric <- function(x) as.numeric(as.character(x))
factorsNumeric <- function(data) modifyList(data, lapply(data[,
sapply(data, is.logical)],asNumeric))
data=read.fwf(filename, widths=c(c1),skip=18, header=FALSE)
data$V2<-as.numeric(gsub(" ","", as.character(data$V2) , fixed=TRUE))
f <- factorsNumeric(data)
Any help is appreciated.
Best,
Alemu
[[alternative HTML version deleted]]
</pre>Alemu Tadesse2014-10-29T19:20:59Search EngineSearch the mailing list at Gmanequery
http://search.gmane.org/?group=$group=gmane.comp.lang.r.general