Hi Luis, thanks for the suggestion, but still nothing:
> RECinf2<-subset(REC2, INFECTION==1) > head(RECinf2) [1] RINGNO year ccFLEDGE rec2012 binage INFECTION all.rsLD <0 rows> (or 0-length row.names) cheers, Kasia Katarzyna Kulma PhD Student Department of Ecology and Genetics Institute of Ecology and Evolution/Animal Ecology Uppsala University Norbyvägen 18D SE-752 36 Uppsala, Sweden email: katarzyna.ku...@ebc.uu.se Tel.+46 (0)18 471 2672 Fax.+46 18 471 6484 On 3 May 2013 14:13, Luis Iván Ortiz Valencia <liov2...@gmail.com> wrote: > $ INFECTION: Factor w/ 2 levels "Infected ","Uninfected ": 2 1 2 1 2 2 1 2 > > it is a factor variable, so it takes numeric values, for "Infected " it > is assigned value 1. > > subset(REC2, INFECTION==1) > > > 2013/5/3 Jorge I Velez <jorgeivanve...@gmail.com> > >> Hi Kasia, >> >> You need >> >> subset(REC2, INFECTION=="Infected ") >> >> (note the space after "Infected"). >> >> HTH, >> Jorge.- >> >> >> On Fri, May 3, 2013 at 7:48 PM, Katarzyna Kulma >> <katarzyna.ku...@gmail.com>wrote: >> >> > Hi everyone, >> > >> > I know there have been several requests regarding subsetting before, but >> > none of them really helps with my problem: >> > >> > I'm trying to subset only infected individuals from the REC2 data.frame: >> > >> > > str(REC2) >> > 'data.frame': 362 obs. of 7 variables: >> > $ RINGNO : Factor w/ 370 levels "BL17546","BL17577",..: 78 81 67 41 >> 58 >> > 66 17 >> > $ year : Factor w/ 8 levels "Y2002","Y2003",..: 1 2 1 2 1 1 2 1 1 3 >> > ... >> > $ ccFLEDGE : int 6 6 6 5 6 7 6 7 6 5 ... >> > $ rec2012 : int 2 1 2 2 1 2 1 1 1 0 ... >> > $ binage : Factor w/ 2 levels "ad","juv": 1 2 1 1 1 1 1 1 1 1 ... >> > $ INFECTION: Factor w/ 2 levels "Infected ","Uninfected ": 2 1 2 1 2 2 >> 1 2 >> > 2 1 ... >> > $ all.rsLD : num -4.62 -6.19 -3.62 -4.19 -2.62 ... >> > >> > using either >> > >> > RECinf<-REC2[which (REC2$INFECTION=="Infected"),] >> > >> > or >> > >> > RECinf<-subset(REC2, INFECTION=="Infected") >> > >> > in both cases I get empty data frame (0 observations): >> > >> > > str(RECinf) >> > 'data.frame': 0 obs. of 7 variables: >> > $ RINGNO : Factor w/ 370 levels "BL17546","BL17577",..: >> > $ year : Factor w/ 8 levels "Y2002","Y2003",..: >> > $ ccFLEDGE : int >> > $ rec2012 : int >> > $ binage : Factor w/ 2 levels "ad","juv": >> > $ INFECTION: Factor w/ 2 levels "Infected ","Uninfected ": >> > $ all.rsLD : num >> > >> > When subsetting, R doesn't return any warning or error message. >> Besides, I >> > used same codes many times before and they worked perfectly well. Any >> ideas >> > why this case is different? >> > >> > Thanks for your help, >> > Kasia >> > >> > [[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. >> > >> >> [[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. >> > > > > -- > Luis Iván Ortiz Valencia > Doutorando Saúde Pública - Epidemiologia, IESC, UFRJ > Estatístico Msc. > Spatial Analyst Msc. > > [[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.