Also tried this but results werent any different

subset1<- subset(dframe, glb_ind="Y" | sample==1 | !is.na(glb_ind))
subset2<-subset(dframe, cwar_ind="Y" |sample==2 | !is.na(cwar_ind))
subset3<-subset(dframe, reg_ind="Y" | sample==3 | !is.na(reg_ind))


On Wed, Jun 5, 2013 at 9:33 AM, Daniel Tucker
<daniel.tuc...@rochester.edu>wrote:

> I am trying to create a new datafarme using the subset function given 2
> conditions
>
> subset1<- subset(dframe, glb_ind="Y" | sample==1)
> subset2<-subset(dframe, cwar_ind="Y" | sample==2)
> subset3<-subset(dframe, reg_ind="Y" | sample==3)
>
> However, my first conditions (glb_ind,cwar_ind, and reg_ind) all have
> missing values (they are either Y, N, or no value. In subsetting my data, I
> am looking to not only get rid of the "N" in the new dataframes, but also
> the NA's. I don't want to na.omit the entire data frame; I only want to get
> rid of missing values (and non Y values) for a certain variable (glb_ind,
> cwar_ind, reg_ind) for each subset. Is there anyway I can do this?
>
> Thanks,
> Dan
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to