Dear R I recently created some variables in R as in I opened a data set and then produced log base 10 transformations on some of the variables. When I ask R to do a simple x, y plot it recognises the raw data but does not recognise the log transformed variables. It says> plot(logbrw, ParaSleep, type="n")Error in plot(logbrw, ParaSleep, type = "n") : Object "logbrw" not found> text(logbrw, ParaSleep, labels=row.names(sleep), cex=0.8, col="blue")Error in text(logbrw, ParaSleep, labels = row.names(sleep), cex = 0.8, : Object "logbrw" not found So do I have to somehow change the data for R to recognise the newly created variables? What should I do? brett
I assume "opened a data set" means that you have attached a data frame. If you add new variables to the data frame (e.g. by transforming a variable in that data.frame), you will have to detach() and re- attach() it in order to get access to the variables without using the $ operator. I think this is in the manual somewhere. Cheers, Simon.>Dear R >I recently created some variables in R as in I opened a data set and then >produced log base 10 transformations on some of the variables. When I ask R >to do a simple x, y plot it recognises the raw data but does not recognise >the log transformed variables. It says > >> plot(logbrw, ParaSleep, type="n") >Error in plot(logbrw, ParaSleep, type = "n") : > Object "logbrw" not found >> text(logbrw, ParaSleep, labels=row.names(sleep), cex=0.8, col="blue") >Error in text(logbrw, ParaSleep, labels = row.names(sleep), cex = 0.8, : > Object "logbrw" not found > > >So do I have to somehow change the data for R to recognise the newly created >variables? > >What should I do? > >brett > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html-- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Visiting Fellow School of Botany & Zoology The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 8057 email: Simon.Blomberg at anu.edu.au F: +61 2 6125 5573 CRICOS Provider # 00120C
Marc Schwartz
2005-Mar-17 04:16 UTC
[R] New Vars in Data Frame Not Visible (was: no subject)
On Thu, 2005-03-17 at 14:43 +1100, Simon Blomberg wrote:> I assume "opened a data set" means that you have attached a data > frame. If you add new variables to the data frame (e.g. by > transforming a variable in that data.frame), you will have to > detach() and re- attach() it in order to get access to the variables > without using the $ operator. I think this is in the manual somewhere.<snip> "An Introduction To R", Section 6.3.2 "attach() and detach()", starting on page 27 and continuing on page 28. HTH, Marc Schwartz