Re: [R] automatic selection of object without loop

2011-09-19 Thread R. Michael Weylandt
What exactly are you looking to do? If it's just to get the name, drop the get() call and just put: q1 <- kinderrechte[,q0] l1 <- paste(q0,"_l",sep="") Michael Weylandt On Mon, Sep 19, 2011 at 6:55 AM, Marion Wenty wrote: > hi jim, > > with the function "get" I could solve the problem using the

Re: [R] automatic selection of object without loop

2011-09-19 Thread Marion Wenty
hi jim, with the function "get" I could solve the problem using the following commands: q1 <- kinderrechte[,q0] l1 <- get(paste(q0, "_l", sep = "")) in this way i am getting the content of the object instead of the name of the object. thank you very much for your help! marion 2011/9/16 jim h

Re: [R] automatic selection of object without loop

2011-09-16 Thread Marion Wenty
hello jim, thank you for your reply. Do you know a solution without having to use a loop? Marion 2011/9/16 jim holtman > for (i in names(kinderrechte)){ >q1 <- kinderrechte[, i] >i 1 <- get(i) > } > > On Fri, Sep 16, 2011 at 4:47 AM, Marion Wenty > wrote: > > Hello, > > > > does anyo

Re: [R] automatic selection of object without loop

2011-09-16 Thread jim holtman
You have to give more specifications as to what you want to do with the data that is being processed. You have values being put into 'q1' and 'i1' that don't seem to be used in the loop. Do you just want these values returned? You can easily do it "without a loop" using lapply: result <- lapply

Re: [R] automatic selection of object without loop

2011-09-16 Thread jim holtman
did not see the "_l" so changes below: On Fri, Sep 16, 2011 at 8:33 AM, jim holtman wrote: > for (i in names(kinderrechte)){ >    q1 <- kinderrechte[, i] >    i 1 <- get(paste(i, "_l", sep = "")) > } > > On Fri, Sep 16, 2011 at 4:47 AM, Marion Wenty wrote: >> Hello, >> >> does anyone know the so

Re: [R] automatic selection of object without loop

2011-09-16 Thread jim holtman
for (i in names(kinderrechte)){ q1 <- kinderrechte[, i] i 1 <- get(i) } On Fri, Sep 16, 2011 at 4:47 AM, Marion Wenty wrote: > Hello, > > does anyone know the solution to this problem: > > I imported a dataframe from Spss into R and saved it as an object called > "kinderrechte". > > I hav