r - subset a data.frame with multiple conditions -
Suppose your data looks like this:
2372 Kansas KS2000111 Humboldt, Atrazine 1.3 city 07/05/2006 9104 Kansas KS2000111 Humboldt, atrazine 0.34 minutes 23/07/2006 9212 Kansas KS2000111 Humboldt, atrazine city 0.33 11/02/2007 2094 Kansas KS2000111 Humboldt, atrazine 1.4 2007/05/06 16,763 Kansas KS2000111 city Humboldt, city atrazine 0.61 2009/05/11 1076 Kansas KS2000111 Humboldt, METOLACHLOR city 0.48 12/05/2002 1077 Kansas KS2000111 Humboldt, METOLACHLOR city 0.3 2006/05/07
< P> i Anilit Door Subsets and I want to be able to date a partial match (ie I want to just old). I am trying this, but I know that this is not exactly right. data [data $ $ = $ "atrazine" & amp; Grep ("2006", as.character (data $ date)),]
Any suggestions?
I approach in response to the Apprentice line to remove years from date of issue but My suggestion is compared to matching normal string:
data [data $ $ = $ "atarazine" & amp; As.POSIXlt (data $ date, format = "% m /% d /% Y") $ years == 106]
If you really had to match regexp, then you do use could grepl
which grep
which gives a logical vector instead of a vector returns the indices.
data [data $ analyte == "atrazine" & amp; Grepl ( "2006", as.character (data $ date)),]
Comments
Post a Comment