I am trying to subset a data based on <=
logic using dplyr
in R
. Even after running filter
function, the data is not being filtered.
How can I fix this?
Code
library(tidyverse)
value = c("a,b,c,d,e,f")
Year = c(2020,2020,2020,2020,2020,2020)
Month = c(01,01,12,12,07,07)
dummy_df = data.frame(value, Year, Month)
dummy_df = dplyr::filter(dummy_df, Month <=07)
Now on a dummy
data frame this does work, but when I use this function on an actual data set with in which I created Year
, Month
and Day
columns using lubridate
; I still see data from months greater than 07
.
<= 7
what do you expect – akrun07
with prefix 0 is still numeric unless you have an actual string"07"
, then the filter is different – akrun