【问题标题】:"Object not found" in R StudioR Studio 中的“找不到对象”
【发布时间】:2023-01-01 22:31:52
【问题描述】:

我最初绘制了一个散点图,然后成功地进行了我的统计分析,但是,当我将误差线添加到我的初始图中时,它现在说 object not found 我已附上我的代码和显示的错误。任何帮助将不胜感激,因为我是 R Studio 的新手。

library(readxl)
combined <- read_excel("Data-raw/combined.xlsx")
View(combined)
ls(combined)
ls(combinedsum)


# Plotting the data  
ggplot() +
  geom_point(data = combined, aes, (Salt_concentration), y = generation_time)


# Summaries the data 
combinedsum <- combined %>% 
  group_by(Salt_concentration) %>% 
  summarise(mean = mean(generation_time),
            std = sd(generation_time),
            n = length(generation_time),
            se = std/sqrt(n))

# Running the anova 
mod <- aov(data = combined,
           generation_time ~ Salt_concentration)

summary(mod)

# Checking assumptions 
hist(mod$residuals)
shapiro.test(mod$residuals)

plot(mod, which=1)

# The results are not normally distributed, 
# Residuals not normal, and unequal variance is present. Non param-metric equilaveltn is needed. 

kruskal.test(data = combined, generation_time ~ Salt_concentration)

# There is a significant effect of Salt-concentration on generation_time. 
# To determine which groups differ Post-hoc test needed e.g., kruskalmc() in pgirmess package
install.packages('pgirmess')
library(pgirmess)
kruskalmc(data = combined, generation_time ~ Salt_concentration)

显示错误

图层错误(数据=数据,映射=映射,stat=stat,geom=GeomPoint,:找不到对象'salt_concentration'

感谢您的帮助。

【问题讨论】:

    标签: r ggplot2 rstudio


    【解决方案1】:

    当你执行

    colnames(combined)
    

    你看到Salt_concentration列了吗?

    【讨论】:

    • 代码运行但不显示列。 – 吉姆 G
    • @LeahSmith:更新了我的答案。请尝试 colnames。
    猜你喜欢
    • 2018-01-06
    • 1970-01-01
    • 2016-02-19
    • 1970-01-01
    • 2019-04-05
    • 1970-01-01
    • 2018-08-15
    • 1970-01-01
    相关资源
    最近更新 更多