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
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
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
> -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
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
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
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
>
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
8 matches
Mail list logo