I have an Excell file of COVID-19 cases for our county going back to January. I want to use the same Excel file but plot a new graph for only the month of June. D is how I labeled the column with all the dates. I'm very new to R and Ggplot so I don't know much about the correct commands. Here's what I've tried but neither work:
line_df <- COVID_ButteCounty_Master
filter (D = 2020-06-01 | D = 2020-06-23)
Error: unexpected '=' in " filter (D = 2020-06-01 | D ="
also
line_df <- COVID_ButteCounty_Master
filter(D >= as.Date("2020-06-01"))
Error in >=.default(D, as.Date("2020-06-01")) :
comparison (5) is possible only for atomic and list types
Are you using the pipe operator, %>%, in between the two lines of code provided? Second, in order to evaluate equivalence in R, two equal signs are needed. I also added quotes around the date as without quotes, 2020-06-01, will be evaluated as a mathematical formula.
line_df has 0 rows so that means there are no rows in COVID_ButteCounty_Master that pass the filter Date == "2020-06-01" | Date == "2020-06-23". Either those dates aren't in the the dataset or the filter is not in the right format. What are the values of Date? What is the class of Date? If it's a Date class, what is the format?
I'm guessing the dates in the filter are not actually in the database. Have you tried your code for a date you know is in the data? Can copy in the reply the output of dput(head(COVID_ButteCounty_Master))?