简体   繁体   English

Blogdown 中的 UseMethod(“select_”) 错误

[英]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.

相关问题 UseMethod(“ select_”)中的错误 - Error in UseMethod(“select_”) Rmarkdown Error Quitting Error in UseMethod(“select_”): no applicable method for 'select_'应用于 class 的 object "函数 - Rmarkdown Error Quitting Error in UseMethod(“select_”) : no applicable method for 'select_' applied to an object of class "function UseMethod 中的错误:没有适用于“select_”的方法应用于类“function”的对象 - Error in UseMethod: no applicable method for 'select_' applied to an object of class "function" UseMethod("select_") 中的错误:没有适用于“select_”的方法应用于“character”类的对象 - Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "character" 错误:UseMethod(“select_”):没有适用于“select_”的方法应用于 class“字符”的 object,以获取直方图可用格式的数据 - Error:UseMethod(“select_”) : no applicable method for 'select_' applied to an object of class “character” to get data in usable format for histograms dplyr中的select_返回异常 - select_ in dplyr returns exception 在select_中构造变量名 - Construct variable names in select_ UseMethod(“select”)中的错误:没有适用于“select”的方法应用于 class “logical”的 object - Error in UseMethod("select") : no applicable method for 'select' applied to an object of class "logical" UseMethod(“select”)中的错误:没有适用于“select”的方法应用于 class“字符”的 object - Error in UseMethod("select") : no applicable method for 'select' applied to an object of class "character" dplyr::select_ 行为与因子 - dplyr::select_ behavior with factor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM