I am using Blogdown
to create a new post and I am getting the following error when trying to preview.
The code works well in my Rmarkdown file but I cannot update it to my blog. Do anyone know where the problem is?
Quitting from lines 36-47 Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "function" Calls: local ... freduce -> -> select -> select.default -> select_ Execution halted
Here is my code in lines 36-47;
library(corrplot)
library(RColorBrewer)
library(tidyverse)
corrplot(cor(df %>% select(Sales, Customers, Store,
Open, SchoolHoliday,
DayOfWeek, month, year,
CompetitionDistance,
Promo, Promo2_active) %>%
filter(!is.na(Sales), !is.na(CompetitionDistance))),
type="upper", order="original",
col=brewer.pal(n=8, name="RdYlBu"))
Thanks a lot.
I think you're getting this error because you don't have an object called df
in your global environment. Either your data frame hasn't been created yet or it is called something else. There is a little-known function called df
in the stats package, which is on the search path when you start an R session. You can check this by starting a new R session and typing df
into the console. You will see the body of the function stats::df
.
You are therefore getting the error because you are trying to subset a function, not a data frame. To resolve the error, make sure you create a data frame called df
before your call to corrplot