Subset a data frame based on date

I have daily flow data for 47 years.I want to seprate my data based on dates more specfically based on months. I face following error while trying to execute
dataset <- read_xlsx("BQ.Flow.xlsx")
as.Date(dataset[["Date"]], "%y-%m-%d") <- selectByDate(dataset, start = "1971-01-01", end = "2017-12-31", year = 1971, month =
c("dec", "jan", "feb"))

Error in as.Date.default(x, ...) : do not know how to convert 'x' to class “Date”

In base R, objects doesn't get edited "in-place", you have to explicitly assign changes.

dataset$Date <- as.Date(dataset$Date, "%y-%m-%d")

I did it but again same error is coming

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue and including sample data? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.