Re: [R] selection part of "subset"

2012-01-09 Thread Christof Kluß
Hi thank you very much for your useful answers! In this case I solved it with Sarah's suggestion tab[tab[[name]] == v,] that works fine Greetings Christof Am 05-01-2012 16:51, schrieb Christof Kluß: > Hi > > I want to do something like > > a <- c(10,20,15,43,76,41,25,46) > tab <- data.fram

Re: [R] selection part of "subset"

2012-01-05 Thread peter dalgaard
On Jan 5, 2012, at 17:04 , Christof Kluß wrote: > Hi > > the output should look like r <- subset(tab, a==v) > but now I have something like r <- subset(tab, "a"==v) > and r <- subset(tab, [["a"]]==v) > does not work :( Presumably something with eval, bquote and

Re: [R] selection part of "subset"

2012-01-05 Thread Marc Schwartz
On Jan 5, 2012, at 10:04 AM, Christof Kluß wrote: > Hi > > the output should look like r <- subset(tab, a==v) > but now I have something like r <- subset(tab, "a"==v) > and r <- subset(tab, [["a"]]==v) > does not work :( > > greetings > Christof > > Am 05-01-20

Re: [R] selection part of "subset"

2012-01-05 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Christof Kluß > Sent: Thursday, January 05, 2012 8:04 AM > Cc: r-h...@stat.math.ethz.ch > Subject: Re: [R] selection part of "subset" > > H

Re: [R] selection part of "subset"

2012-01-05 Thread Milan Bouchet-Valat
Le jeudi 05 janvier 2012 à 16:51 +0100, Christof Kluß a écrit : > Hi > > I want to do something like > > a <- c(10,20,15,43,76,41,25,46) > tab <- data.frame(a) > > name <- "a" > > for (v in unique(tab[[name]])) { > r <- subset(tab, name==v) # this does not work > ... > } > > i.e. a "stri

Re: [R] selection part of "subset"

2012-01-05 Thread Sarah Goslee
I don't know how to do it with subset, but this is equivalent for your example: tab[tab[[name]] == v,] Also, you might want to look at ?"==" and ?identical. Sarah On Thu, Jan 5, 2012 at 11:04 AM, Christof Kluß wrote: > Hi > > the output should look like     r <- subset(tab, a==v) > but now I h

Re: [R] selection part of "subset"

2012-01-05 Thread Christof Kluß
Hi the output should look like r <- subset(tab, a==v) but now I have something like r <- subset(tab, "a"==v) and r <- subset(tab, [["a"]]==v) does not work :( greetings Christof Am 05-01-2012 16:51, schrieb Christof Kluß: > Hi > > I want to do something like >

[R] selection part of "subset"

2012-01-05 Thread Christof Kluß
Hi I want to do something like a <- c(10,20,15,43,76,41,25,46) tab <- data.frame(a) name <- "a" for (v in unique(tab[[name]])) { r <- subset(tab, name==v) # this does not work ... } i.e. a "string" on the left side of the select expression (subset). How could I solve this? thx Christof