[R] Division of data frame and deletion of values from column
John Kane
jrkrideau at yahoo.ca
Fri Oct 16 19:20:07 CEST 2009
?subset
?split
--- On Fri, 10/16/09, Joel Fürstenberg-Hägg <joel_furstenberg_hagg at hotmail.com> wrote:
> From: Joel Fürstenberg-Hägg <joel_furstenberg_hagg at hotmail.com>
> Subject: [R] Division of data frame and deletion of values from column
> To: r-help at r-project.org
> Received: Friday, October 16, 2009, 12:16 PM
>
> 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
> .
> .
> .
>
> 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
> .
> .
> .
>
> I really hope someone could help me, though you might think
> it's too easy...
>
> Best regards,
>
> Joel
>
>
>
>
> _________________________________________________________________
> Hitta kärleken nu i vår!
> http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
> [[alternative HTML version deleted]]
>
>
> -----Inline Attachment Follows-----
>
> ______________________________________________
> 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.
>
__________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share wha
More information about the R-help
mailing list