Reputation: 1057
I have a text file consisting of 6 columns as shown below. the measurements are taken each 30 mint for several years (2001-2013) and sometimes differ each 32 or 39 for certain days. I want to extract and select certain range from this data.
to read the file:
LR=read.table("C:\\Users\\dat.txt", sep ='', header =TRUE)
header:
now to subset for 2008 and 2009 and hour =23 I used:
dat=subset(wg, Year > 2007 & Year < 2010 & hour == 23 & mint==30)
that worked fine but as I said there is different mints that I want to consider also.So I did this:
dat=subset(wg, Year > 2007 & Year < 2010 & hour == 23 & mint==30 | 32 | 39 |40 |41 | 49 | 31)
but the output dat
is not correct and there are years out of the range i.g, 2003, 2004
Any help please
Upvotes: 0
Views: 141
Reputation: 887901
You could try
dat <- subset(wg, Year > 2007 & Year < 2010 & hour == 23 &
mint %in% c(30, 32, 39, 40, 41, 49, 31))
Upvotes: 2