[R] Subset a column with specific characters

Kuma Raj pollaroid at gmail.com
Thu Sep 4 23:58:54 CEST 2014


This post has NOT been accepted by the mailing list yet.
I would like to subset a column based on the contents of a column with
specific character. In the sample data I wish to do the following:

First keep the data based on column "prog" if prog contains "ca", and
secondly to drop if race contains "ic"

Thanks

library(foreign)
hsb2 <- read.dta('http://www.ats.ucla.edu/stat/stata/notes/hsb2.dta')



More information about the R-help mailing list