Re: [R] Accessing an object using a string

2016-08-16 Thread Greg Snow
y thanks for all your answers and help. Currently I store all my >>> objects in .GlobalEnv = Workspace. I am not yet familiar working with >>> different environments nor did I see that this would be necessary for my >>> analysis. >>> >>> Could you explain why wo

Re: [R] Accessing an object using a string

2016-08-16 Thread Ista Zahn
orking with >> different environments nor did I see that this would be necessary for my >> analysis. >> >> Could you explain why working with different environments would be >> helpful? >> >> You suggested to read variables into lists rather than storing them

Re: [R] Accessing an object using a string

2016-08-16 Thread Bert Gunter
o do your homework for you, at least IMHO (others may disagree). Cheers, Bert > > Kind regards > > Georg > > > > Von:Greg Snow <538...@gmail.com> > An: g.maub...@weinwolf.de, > Kopie: r-help > Datum: 15.08.2016 20:33 > Betreff:Re: [R] Acces

Re: [R] Accessing an object using a string

2016-08-16 Thread Greg Snow
use this? > > Kind regards > > Georg > > > > Von:Greg Snow <538...@gmail.com> > An: g.maub...@weinwolf.de, > Kopie: r-help > Datum: 15.08.2016 20:33 > Betreff:Re: [R] Accessing an object using a string > > > > The names function

Re: [R] Accessing an object using a string

2016-08-15 Thread Greg Snow
Hmm, names appears to be both primitive and generic, since when I look at the function definition (3.3.0) I see: > names function (x) .Primitive("names") This is what I was referring to as the primitive. I had originally intended to look at the code for names to see how it accessed the attribut

Re: [R] Accessing an object using a string

2016-08-15 Thread William Dunlap via R-help
'names' is an S3-generic function. E.g., in R-3.3.0: > names.unnamed <- function(x) sprintf("#%0*d", ceiling(log10(length(x))), seq_along(x)) > u <- structure(letters, class="unnamed") > names(u) [1] "#01" "#02" "#03" "#04" "#05" "#06" "#07" [8] "#08" "#09" "#10" "#11" "#12" "#13" "#1

Re: [R] Accessing an object using a string

2016-08-15 Thread Greg Snow
The names function is a primitive, which means that if it does not already do what you want, it is generally not going to be easy to coerce it to do it. However, the names of an object are generally stored as an attribute of that object, which can be accessed using the attr or attributes functions

[R] Accessing an object using a string

2016-08-15 Thread G . Maubach
Hi All, I would like to access an object using a sting. # Create example dataset var1 <- c(1, 2, 3) var2 <- c(4, 5, 6) data1 <- data.frame(var1, var2) var3 <- c(7, 8, 9) var4 <- c(10, 11, 12) data2 <- data.frame(var3, var4) save(file = "c:/temp/test.RData", list = c("data1", "data2")) # Define