[R] does save.image() also save the random state?

2016-02-05 Thread Jinsong Zhao
Dear there, Here is a snipped code, > rm(list = ls()) > x <- 123 > save.image("abc.RData") > rm(list = ls()) > load("abc.RData") > sample(10) [1] 3 7 4 6 10 2 5 9 8 1 > rm(list = ls()) > load("abc.RData") > sample(10) [1] 3 7 4 6 10 2 5 9 8 1 you will see that, after

Re: [R] Subset with missing argument within a function

2016-02-05 Thread William Dunlap via R-help
R's subscripting operators do not "guess" the value of a missing argument: a missing k'th subscript means seq_len(dim(x)[k]). I bet that you use syntax like x[,1] (the entire first column of x) all the time and that you don't want this syntax to go away. Some languages use a placeholder like '.'

Re: [R] does save.image() also save the random state?

2016-02-05 Thread Duncan Murdoch
On 05/02/2016 11:14 AM, Jinsong Zhao wrote: Dear there, Here is a snipped code, > rm(list = ls()) > x <- 123 > save.image("abc.RData") > rm(list = ls()) > load("abc.RData") > sample(10) [1] 3 7 4 6 10 2 5 9 8 1 > rm(list = ls()) > load("abc.RData") > sample(10)

[R] Create macro_var in R

2016-02-05 Thread Amoy Yang via R-help
One more question (see below). I cannot use macro-var, mvar, for creating new name, as shown below. Any advice is highly appreciated! > mvar<-"pop" > new.pop<-tab[[mvar]]; new.pop  [1]  698 1214 1003 1167 2549  824  944 1937  935  570    0 > new.tab[[mvar]]<-d$pop; Error in new.tab[[mvar]]

Re: [R] does save.image() also save the random state?

2016-02-05 Thread Dénes Tóth
On 02/05/2016 05:25 PM, Duncan Murdoch wrote: On 05/02/2016 11:14 AM, Jinsong Zhao wrote: Dear there, Here is a snipped code, > rm(list = ls()) > x <- 123 > save.image("abc.RData") > rm(list = ls()) > load("abc.RData") > sample(10) [1] 3 7 4 6 10 2 5 9 8 1 > rm(list

[R] Alignment of a double plot where one has a switched axis

2016-02-05 Thread Gavin Rudge
Hi Rgonauts, I am plotting 3 variables from one data set on one plot. Two of them as a stacked bar and a ratio on a completely different scale, so I need to put one of the axes on the top of the plot for clarity. Whilst this is not good visualisation practice, there is a valid reason why,

[R-es] OT ¿Que pasa con RStudio?

2016-02-05 Thread Manuel Máquez
Buenos días colegas: Alguien sabe ¿qué pasa con Rstudio y Ubuntu 15.10?, porque no se puede acceder a Rstudio; aparentemente falta el paquete libgstreamer 0.10-0, pero no lo encuentro; ¿será que es de otra versión de Ubuntu? Ojalá que alguien me pueda orientar, en tanto, anticipo las más

[R] reading in multiple data sets in 2 loops

2016-02-05 Thread Reka Howard
Hello, I have over 1000 csv data sets I need to read into R, so I want to read them in using a loop. The data sets are named as pheno_1000ind_4000m_add_h70_prog_1_2.csv, pheno_1000ind_4000m_add_h70_prog_1_3.csv, ... so I need 2 loops (for the last 2 numbers in the names). What I would like to do

Re: [R] Create macro_var in R

2016-02-05 Thread William Dunlap via R-help
If 'tab' is a data.frame then new.tab <- tab[[mvar]] is a column from that data.frame, not a data.frame with one column. new.tab <- tab[ , mvar, drop=FALSE ] will give you a data.frame that you can add to with either of nvar <- "newName" new.tab[ , nvar] <- newColumn new.tab[[nvar]]

Re: [R] does save.image() also save the random state?

2016-02-05 Thread Duncan Murdoch
On 05/02/2016 11:49 AM, Dénes Tóth wrote: On 02/05/2016 05:25 PM, Duncan Murdoch wrote: > On 05/02/2016 11:14 AM, Jinsong Zhao wrote: >> Dear there, >> >> Here is a snipped code, >> >> > rm(list = ls()) >> > x <- 123 >> > save.image("abc.RData") >> > rm(list = ls()) >> >

Re: [R] pearson correlation matrix

2016-02-05 Thread Michael Dewey
On 05/02/2016 17:10, emmanuelle morin wrote: ok, it will still make sense ? Whether it makes sense to correlate the people rather than the variables depends on the underlying science which (a) we do not know, and (b) is not really an R question. Le 05/02/2016 15:31, Michael Dewey a

Re: [R] Create macro_var in R

2016-02-05 Thread MacQueen, Don
Yes, you can use a name stored in a variable to create a new column in a data frame (guessing that's what you want). Here's an example: > df <- data.frame(a=1:5) > df[['b']] <- 2:6 > df a b 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 > mvar <- 'c' > df[[mvar]] <- 0:4 > df a b c 1 1 2 0 2 2 3 1 3 3 4 2 4 4

Re: [R] Create macro_var in R

2016-02-05 Thread Jeff Newmiller
You REALLY NEED to read the "Introduction to R" document discussion of indexing. tab is a variable. It is apparently a data.frame. tab[[mvar]] is an expression that retrieves part of the data in the tab data.frame. The data it returns is a vector, not a data.frame. The "[[" operator

Re: [R] pearson correlation matrix

2016-02-05 Thread emmanuelle morin
ok, it will still make sense ? Le 05/02/2016 15:31, Michael Dewey a écrit : Assuming your dataset is in a matrix you want to transpose it. So you can go t(mesdonnees) and then call cor on that. On 05/02/2016 14:06, emmanuelle morin wrote: Hello, I have a set of 12 individuals with thousands

Re: [R] Accessing specific data.frame columns within function

2016-02-05 Thread Greg Snow
You are trying to use shortcuts where shortcuts are not appropriate and having to go a lot longer around than if you did not use the shortcut, see fortune(312). You should really reread the help page: help("[[") and section 6.1 of An Introduction to R. Basically you should be able to do

[R] hourly prediction time series

2016-02-05 Thread AURORA GONZALEZ VIDAL
Dear R users, I am fronting my firts time series problem. I have hourly temperature data for 3 years (from 01/01/2013 to 5/02/2016). I would like to use those in order to PREDICT TEMPERATURE OF THE NEXT HOURS according to the observations. A subset of the data look like this: date <-

Re: [R] hourly prediction time series

2016-02-05 Thread Sean Porter
Try the auto.arima function in the forecast package.. Regards, DR SEAN PORTER Scientist South African Association for Marine Biological Research Direct Tel: +27 (31) 328 8169 Fax: +27 (31) 328 8188 E-mail: spor...@ori.org.za Web: www.saambr.org.za 1 King Shaka Avenue, Point, Durban 4001

Re: [R] hourly prediction time series

2016-02-05 Thread Giorgio Garziano
Some good references: https://www.otexts.org/fpp http://link.springer.com/book/10.1007%2F978-0-387-88698-5 http://www.statoek.wiso.uni-goettingen.de/veranstaltungen/zeitreihen/sommer03/ts_r_intro.pdf Best, -- GG This Communication is Ericsson Confidential. We only send and receive email on

Re: [R] R project and the TPP

2016-02-05 Thread John Logsdon
Folks TPP, and in a European context, TTIP are very dangerous not only to open source software but to any public service and no satisfactory response has been forthcoming. There are ways of circumventing it I guess or opposing it (maybe using ISPs in China, Russia or North Korea???). The issue

Re: [R] R project and the TPP

2016-02-05 Thread Boris Steipe
Does that mean I could poison the Archive by posting IP on this list, or poison someone else's code if they use some of mine that I post here? B. On Feb 4, 2016, at 7:48 PM, Spencer Graves wrote: > It's not clear if the TPP would ever directly

Re: [R] Package for error analysis

2016-02-05 Thread S Ellison
> I'm doing error analysis of predictive models and I need to calculate global > error, this is, I need to calculate the resultant error from propagation of > indirect measurements errors. If the problem is propagation of variance on inputs through a known function, you could look at uncert() in

Re: [R] R project and the TPP

2016-02-05 Thread José Bustos
Thank everyone, I have found some good, but limited infomation about it. As Ross Ihaka mention in his presentation: "Houston, We Have a Problem". The R software is a important part of the Free Software Fundation, they have been fighting back TPP long time, but last weeks in Chile was not so good.

[R] pearson correlation matrix

2016-02-05 Thread emmanuelle morin
Hello, I have a set of 12 individuals with thousands of variables measured. I understand that when I'm using the cor() function on my matrix I'm calculating the correlation between the different variables according to their values for the different individuals. What I'm willing to do is to

Re: [R] pearson correlation matrix

2016-02-05 Thread David L Carlson
Assuming your data is called BIG and has 12 rows and thousands of columns: cor(t(BIG)) - David L Carlson Department of Anthropology Texas A University College Station, TX 77840-4352 -Original Message- From: R-help

Re: [R] pearson correlation matrix

2016-02-05 Thread Michael Dewey
Assuming your dataset is in a matrix you want to transpose it. So you can go t(mesdonnees) and then call cor on that. On 05/02/2016 14:06, emmanuelle morin wrote: Hello, I have a set of 12 individuals with thousands of variables measured. I understand that when I'm using the cor() function on