我得到这个错误每次我试图加载并使用一个函数的CSV文件。我不知道问题出在哪里
"读取. table(file = file,header = header,sep = sep,quote = quote,:"file"必须是字符串或连接"
setwd("/Users/elleryvincent/Desktop/ADFG Black Bear Stable Isotope")
file_path <- "~/Desktop/ADFG Black Bear Stable Isotope/SI_Sp.csv"
mix.filename <- read.table(file_path, header = TRUE, sep = ",", quote = "\"")
source.filename <- read.csv("Sources1_5_2021.csv")
discr.filename <- read.csv("DV_SIDER_omnivore.csv")
n.mod <-10
mix <- vector("list", n.mod)
#Define each model, note the factor or continuous effect
mix[[1]] <- load_mix_data(filename=mix.filename,
iso_names=c("C","N"),
factors=c(NULL),
fac_random=c(NULL),
fac_nested=c(NULL),
cont_effects=c(NULL))
head(mix.filename)
样本性别年龄等级季节月份年份诱饵日分流skullen skulwid长度宽度1 93 M 2 J S 5 2016是1 9. 9375 4. 8750 14. 8125 2 112 M 7 A S 5 2016否2 11. 3125 6. 5000 17. 8125 3 109 M 7 A S 5 2016否4 11. 5625 6. 1250 17. 6875 4 180 M 5 A S 5 2016是2 10. 1875 5 5. 6250 15. 8125 5 5 226 F 3 SA S 5 2017是2 9. 7500 5. 5625 15. 3125 6 208 M 11 A S 5 2016是1 12. 2500 7. 0625 19. 3125 C N 1 - 22. 214 6. 59 2-20.284 5. 94 3-23.864 5. 04 4-22.964 5. 42 5-25.572 5. 54 6-23.454 7. 03
1条答案
按热度按时间ffvjumwh1#
由于没有指定导致错误的具体行,因此根据错误消息,我假设它是
mix.filename <- read.table(file_path, header = TRUE, sep = ",", quote = "\"")
。您已经从setwd(...)
获得了当前工作目录ADFG Black Bear Stable Isotope
。所以你只需要file_path <- "SI_Sp.csv"
。您也可以在setwd(...)
之后执行list.files()
来检查它。注意:除非我弄错了目录,并且您实际上将
Users/elleryvincent/Desktop/ADFG Black Bear Stable Isotope/Desktop/ADFG Black Bear Stable Isotope/SI_Sp.csv
作为有效位置