[R] Removing
Henrique Dallazuanna
wwwhsd at gmail.com
Wed Aug 20 20:36:52 CEST 2008
Try this also:
Dt <- cbind(Age[o],Sex[o],Ill[o])
subset(as.data.frame(Dt), V3 != "No")
On Wed, Aug 20, 2008 at 3:24 PM, <bad2101 at columbia.edu> wrote:
> I think I should be clearer. Given the matrix of column vectors Age, Sex,
> and Ill
>
> Age=c(11,52,65,59,13,63,70,40,15,33,65,38,62,10,25,32,62,36,11,33,13,7,64,3,65,59,15,62,37,17,35,15,50,40,35,35,36,57,16,68,54,77,72,58,20,17,62,20,52,9,50,8,35,48,25,11,74,12,44,53,37,24,69,7,17,8,11,17,36,21,60,18,14,52,45)
> Sex=c("Male","Female","Male","Female","Female","Female","Male","Female","Female","Female","Male","Female","Female","Male","Male","Female","Female","Male","Male","Female","Female","Male","Male","Male","Female","Female","Female","Male","Female","Male","Male","Male","Female","Male","Female","Female","Male","Female","Female","Male","Female","Male","Female","Male","Male","Male","Female","Female","Female","Female","Male","Male","Female","Female","Male","Female","Male","Female","Female","Female","Male","Female","Female","Male","Female","Female","Female","Male","Female","Female","Male","Female","Female","Male","Female")
> Ill=c("No","Yes","Yes","Yes","No","Yes","Yes","Yes","Yes","Yes","No","No","No","Yes","No","Yes","Yes","Yes","No","Yes","Yes","Yes","No","Yes","No","Yes","Yes","No","Yes","No","Yes","Yes","Yes","No","No","Yes","No","Yes","Yes","Yes","No","Yes","Yes","Yes","No","No","Yes","Yes","Yes","No","No","Yes","No","Yes","Yes","No","Yes","Yes","Yes","Yes","No","No","No","No","Yes","Yes","No","No","No","Yes","Yes","Yes","No","Yes","Yes")
> o=order(Ill)
> cbind(Age[o],Sex[o],Ill[o])
>
> I am trying to remove all rows of the matrix in which the element in the Ill
> column vector is "No". I appreciate any help you have to offer.
>
> Brian
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list