Re: [R] R does not subset

2013-05-07 Thread John Field
using ?sub on character data before creating the factor). endquote str_trim in package stringr is great for this. John -- View this message in context: http://r.789695.n4.nabble.com/R-does-not-subset-tp4666129p4666453.html Sent from the R help mailing list archive at Nabble.com

[R] R does not subset

2013-05-03 Thread Katarzyna Kulma
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

Re: [R] R does not subset

2013-05-03 Thread David Kulp
You have an extra space in the INFECTION factors. Use REC2[REC2$INFECTION==Infected ,] or subset(REC2, INFECTION==Infected ) No need to use which here. On May 3, 2013, at 5:48 AM, Katarzyna Kulma wrote: Hi everyone, I know there have been several requests regarding subsetting before, but

Re: [R] R does not subset

2013-05-03 Thread Luis Iván Ortiz Valencia
$ 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,

Re: [R] R does not subset

2013-05-03 Thread Katarzyna Kulma
Hi Luis, thanks for the suggestion, but still nothing: RECinf2-subset(REC2, INFECTION==1) head(RECinf2) [1] RINGNOyear ccFLEDGE rec2012 binageINFECTION all.rsLD 0 rows (or 0-length row.names) cheers, Kasia Katarzyna Kulma PhD Student Department of Ecology and Genetics

Re: [R] R does not subset

2013-05-03 Thread Jorge I Velez
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.comwrote: Hi everyone, I know there have been several requests regarding subsetting before, but none of them really

Re: [R] R does not subset

2013-05-03 Thread Katarzyna Kulma
Jorge, thanks for your suggestions, but they give the same (empty) result: RECinf-subset(REC2, INFECTION==Infected) head(RECinf) [1] RINGNOyear ccFLEDGE rec2012 binageINFECTION all.rsLD 0 rows (or 0-length row.names) but David's suggestion worked! :

Re: [R] R does not subset

2013-05-03 Thread Mihai Nica
...@gmail.com To:Katarzyna Kulma katarzyna.ku...@gmail.com Cc: R mailing list r-help@r-project.org Sent: Friday, May 3, 2013 6:01 AM Subject: Re: [R] R does not subset Hi Kasia, You need subset(REC2,  INFECTION==Infected ) (note the space after Infected). HTH, Jorge.- On Fri, May 3, 2013 at 7

Re: [R] R does not subset

2013-05-03 Thread Jeff Newmiller
From: Jorge I Velez jorgeivanve...@gmail.com To:Katarzyna Kulma katarzyna.ku...@gmail.com Cc: R mailing list r-help@r-project.org Sent: Friday, May 3, 2013 6:01 AM Subject: Re: [R] R does not subset Hi Kasia, You need subset(REC2,� INFECTION==Infected ) (note

Re: [R] R does not subset

2013-05-03 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Katarzyna Kulma Sent: Friday, May 03, 2013 4:21 AM To: David Kulp Cc: r-help@r-project.org Subject: Re: [R] R does not subset Jorge, thanks for your suggestions, but they give

Re: [R] R does not subset

2013-05-03 Thread Mihai Nica
katarzyna.ku...@gmail.com Cc: R mailing list r-help@r-project.org Sent: Friday, May 3, 2013 8:16 AM Subject: Re: [R] R does not subset This typically occurs because of sloppy manual data entry outside of R. To relieve further analysis pain, you can manually clean the data (usually only effective