[R] Find and remove elemnts of a data frame

John Kane jrkrideau at yahoo.ca
Thu Jan 6 16:27:57 CET 2011


With dataframe xx (naming a data.frame as data.frame is a bit dicey

subset(xx, xx[,4]> -45)

--- On Thu, 1/6/11, Alaios <alaios at yahoo.com> wrote:

> From: Alaios <alaios at yahoo.com>
> Subject: [R] Find and remove elemnts of a data frame
> To: r-help at r-project.org
> Received: Thursday, January 6, 2011, 10:07 AM
> Dear all,
> I have a data frame that is created like that 
> data.frame(x=CRX[-1],y=CRY[-1],z=CRagent[[1]]$sr)
> 
> the output looks like
> 45 116 162 -30.89105988567164
> 46 128  79 -42.66296679571184
> 47 180 195 -30.45626175641315
> 48 114  83 -45.26843476475688
> 49 118  73 -46.85389245327003
> 
> 
> How can I select only the rows that their third column is
> higher that -45?
> This will return the following
> 116 162 -30.89105988567164
> 128  79 -42.66296679571184
> 180 195 -30.45626175641315
> 
> I would like to thank you in advance for your help
> 
> Best Regards
> Alex
> 
> 
> 
>       
>     [[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.
> 





More information about the R-help mailing list