【问题标题】:Object not found in R keeps showing在 R 中找不到对象一直显示
【发布时间】:2022-10-14 21:53:01
【问题描述】:

运行此代码时,我收到此错误消息: “视图错误:找不到对象‘filtered_tg’”

data("ToothGrowth")
View(ToothGrowth)
filtered_tg <- filter(ToothGrowth,dose==0.5)
View(filtered_tg)

【问题讨论】:

  • 如果您突出显示filtered_tg 并单击控制输入会发生什么?你有dplyr 加载吗?
  • 你加载library(dplyr)了吗?
  • 对象filtered_tg 不存在。您正在使用filter,我假设您想使用来自dplyr 的那个。你是用library(dplyr) 加载的吗?
  • 您应该在最后一个错误之前出现另一个错误Error in filter(ToothGrowth, dose == 0.5) : object 'dose' not found,因为默认情况下filter 将使用stats::filter
  • 我忘了加载dplyr,谢谢大家!我开始学习这门语言:)

标签: r


【解决方案1】:
# Make changes as below, you have to load dplyr library:::

data("ToothGrowth")
View(ToothGrowth)
library(tidyverse)
library(dplyr)
filtered_tg <- filter(ToothGrowth,dose==0.5)
View(filtered_tg)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-19
    • 2018-08-15
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多