[英]Error in UseMethod(“select_”) in Blogdown
I am using Blogdown
to create a new post and I am getting the following error when trying to preview.我正在使用Blogdown
创建新帖子,但在尝试预览时出现以下错误。 The code works well in my Rmarkdown file but I cannot update it to my blog.该代码在我的 Rmarkdown 文件中运行良好,但我无法将其更新到我的博客。 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 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_ 执行停止
Here is my code in lines 36-47;这是我在第 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.我认为您收到此错误是因为您的全局环境中没有名为df
的 object 。 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. 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.您可以通过启动一个新的 R session 并在控制台中输入df
来检查这一点。 You will see the body of the function stats::df
.您将看到 function stats::df
的主体。
You are therefore getting the error because you are trying to subset a function, not a data frame.因此,您会收到错误,因为您正在尝试对 function 进行子集化,而不是数据帧。 To resolve the error, make sure you create a data frame called df
before your call to corrplot
要解决该错误,请确保在调用corrplot
之前创建一个名为df
的数据框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.