【问题标题】:Rmarkdown Error Quitting Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "functionUseMethod(“select_”)中的Rmarkdown错误退出错误:没有适用于“select_”的适用方法应用于类“函数”的对象
【发布时间】:2020-05-11 16:49:05
【问题描述】:

我在 RMarkdown 中遇到错误。

Quitting from lines 23-54 (Report_Preliminary.Rmd) 
Error in UseMethod("select_") : 
  no applicable method for 'select_' applied to an object of class "function"
Calls: <Anonymous> ... <Anonymous> -> <Anonymous> -> select.default -> select_
Execution halted

这是我正在尝试运行的代码

data_select <- data %>%
  dplyr::select(ID, Age, Gender, Location, Country, Chills, Cough, Diarrhoea, Fatigue, Headcahe, 'Healthcare Worker', 'How Unwell',
              'Long Standing Health Issues', 'Loss of smell and taste', 'Muscle Ache', 'Nasal Congestion', 'Nausea and Vomiting', 
              'Number Of Days Symptoms Showing',
              'Pregnant', 'Self Diagnosis', 'Shortness of Breath', 'Sore Throat','Reason For Helping', 'Sputum', 'Temperature') %>%
  dplyr::rename( id = ID,
                 age = Age,
                 gender = Gender,
                 location =  Location,
                 country = Country,
                 chills = Chills,
                 diarrhoea = Diarrhoea,
                 fatigue = Fatigue,
                 headache = Headcahe,
                 healthcare_worker = 'Healthcare Worker',
                 how_unwell = 'How Unwell',
                 long_standing_health = 'Long Standing Health Issues',
                 loss_smell_taste = 'Loss of smell and taste',
                 muscle_ache = 'Muscle Ache',
                 nasal_congestion = 'Nasal Congestion',
                 nausea_vomiting = 'Nausea and Vomiting',
                 no_days_symptoms_show = 'Number Of Days Symptoms Showing',
                 pregnant =  'Pregnant',
                 shortness_breath = 'Shortness of Breath',
                 sore_throat = 'Sore Throat',
                 sputum = 'Sputum',
                 temperature = 'Temperature',
                 self_diagnosis = 'Self Diagnosis',
                 tested_or_not = 'Reason For Helping')

然而,当我在 Rmarkdown 中运行每个块时,我完全没有问题。我得到了需要的输出。 其他人对此有任何问题吗?

【问题讨论】:

  • 如果没有最低限度的可重现代码,很难帮助你,你能提供吗?
  • Jrm_FRL 我可以,但究竟是什么?既然我认为这就足够了?您指的是整个脚本吗?
  • 请提供您的数据样本!
  • 很抱歉,我不能,因为这是机密工作……我只能说这是一个 Rmarkdown 问题,因为我的块中的功能可以完美运行。

标签: r select r-markdown tidyverse


【解决方案1】:

我已经解决了这个问题,将 data_select 连同所需的所有更改一起保存到一个文件夹中,并使用 read_csv 将其带入。

【讨论】:

    猜你喜欢
    • 2023-04-06
    • 2020-05-25
    • 1970-01-01
    • 1970-01-01
    • 2019-09-12
    • 2022-12-15
    • 2023-01-22
    • 2020-12-05
    • 2021-10-09
    相关资源
    最近更新 更多