[R] Count of rows while looping through data
Phil Spector
spector at stat.berkeley.edu
Fri May 27 21:45:34 CEST 2011
Jeanna -
The family variable is being stored as a factor.
You could eliminate the NA values manually, or you
could try something like
x$family = as.character(x$family)
before subsetting. If neither of these solutions are
satisfactory, please follow the posting guide and provide
a reproducible example.
- Phil
On Fri, 27 May 2011, Jeanna wrote:
> I may have prematurely excited...
>
> I ended up using the split method since my family indicators are
> alphanumeric so my issue is as follows.
>
> I'm applying this to different subsets of my main data set. The subsets do
> not contain all families. When I run the method on one of my subsets I get
> back a table that includes ALL the families. Those that weren't in the
> subset to which I applied the method have <NA> for all of the fields.
>
> If I export one of the subsets, restart R (to be certain nothing of my
> original playtime is left) and import only the subset, the method works
> perfectly.
>
> The addition of the previously removed rows seems to happen at the 'split'
> step.
>
> Is there something I'm doing incorrectly? I can't seem to figure out how to
> convince R not to look at my original data frame when deciding how many
> families there are.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Count-of-rows-while-looping-through-data-tp3547949p3555752.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list