[R] Division of data frame and deletion of values from column
David Winsemius
dwinsemius at comcast.net
Fri Oct 16 18:24:42 CEST 2009
On Oct 16, 2009, at 12:16 PM, Joel Fürstenberg-Hägg wrote:
>
> Hi all,
>
> I guess this might be an easy question, but I've searched multiple
> help pages without finding any answear... so now I put my trust in
> you!
>
> I have a data frame (36 variables and 556 observations). One column
> contains three factors, and I would like to divide the data frame
> into three new ones, based on the value of the factors, thereby
> having only one value for all elements of the particular column in
> each of the data frames. The reason is that I later will create
> plots and do statistical analyzes on these data frames, and I don't
> want those factors affecting the result.
> ID Weight Age_days ...
> 1 18 76.1 106
> 2 19 77.0 175
> 3 20 78.1 121
> 4 21 78.2 121
> 5 22 78.8 106
> 6 23 76.3 106
> .
> .
> .
?split
>
> I also have another column containing several factors, of which I
> would like to exclude one (get NA instead).
>
> ID Weight Age_days Value_ID ...
> 1 18 76.1 106 high
> 2 19 77.0 175 low
> 3 20 78.1 121 middle
> 4 21 78.2 121 high
> 5 22 78.8 106 high
> 6 23 76.3 106 number <-- exclude
> 7 24 76.9 175 low
> .
> .
> .
?is.na # which has an is.na(<- capacity
>
> I really hope someone could help me, though you might think it's too
> easy...
>
> Best regards,
>
> Joel
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list