[R] Create subset using variable
Ben Bolker
bbolker at gmail.com
Sun Jan 22 00:49:03 CET 2012
pansophy <mjs2134 <at> columbia.edu> writes:
>
> I am trying to create a loop that will perform a series of analyses. I am
> using geeglm from geepack, which fails if there are any null values.
> Creating a subset solves this, but do not seem to be able to set the subset
> dynamically based on a changing variable.
>
> while (j <= y.num) {
>
> strSubset = as.character(df.IV$IV[j]) #Gives column name in quotes
> df.data.sub = subset(df.data, strSubset>=0)
>
> #subset dataset is not created
>
> # analyses on subset take place
>
> j = j + 1
> }
>
I've answered this on Stack Overflow. While I don't think there
is any formal policy against cross-posting, I (and at least a few
other participants in both lists) deprecate cross-posting because
it leads to redundant effort.
Ben Bolker
More information about the R-help
mailing list