I want to subset my data set between two distinct dates. I've loaded the data from a text file to R with ';' as separators.
x <- read.table("household_power_consumption.txt", sep = ";", header = TRUE)
head(x)
gives me this:
[head(x)][1]
The data set contains over 200000 lines so I need to subset the data of only two particular dates. So I tried this:
x[Date >= as.Date("2007-02-01") | Date <= as.Date("2007-02-02")]
But I see the following error:
Error in `[.data.frame`(x, Date >= as.Date("2007-02-01") | Date <= as.Date("2007-02-02")) : object 'Date' not found
So what is the problem here? How do I subset the data?