I realize that this is probably quite simple but the results i find online are far more complex than what I have and therefore lose me. in the process of learning R and at this time, creating a simple line chart. The data has values that I need filtered out prior to making the chart. I am looking for monthly data (periodtype = '03') and not annual (periodtype = '01'). Below is the code that i am using and the error that I receive. My data frame, labforce contains both periodtypes in it. Any thoughts on how I should go about this?
con <- dbConnect(odbc::odbc(),"xyz-DB")
> labforce1 <- dbGetQuery(con, "SELECT periodyear,period,unemprate
FROM labforce")
labforce1m <- labforce1 %>%
+ filter (periodtype=='03')
Error in UseMethod("filter_") :
no applicable method for 'filter_' applied to an object of class
"logical"
dput(head(labforce1)) yields the following:
structure(list(periodyear = c("1990", "1990", "1990", "1990",
"1990", "1990"), periodtype = c("03", "03", "03", "03", "03",
"03"), period = c("01", "02", "03", "04", "05", "06"), unemprate =
c(8.9,
8.8, 8.6, 7, 4.6, 5.8), date = structure(c(7305, 7336, 7364,
7395, 7425, 7456), class = "Date")), row.names = c(NA, 6L), class =
"data.frame")
>