首页 > 解决方案 > 使用 MetaboAnalystR 包时导入 .csv 文件时遇到问题

问题描述

我是一个非常新手的 R 用户,并且在使用 RStudio 中的“导入数据集”按钮导入我的 .csv 文件时遇到了困难。我曾尝试查看其他人提出的类似问题,但无济于事。我检查了我的数据集并确保所有空格都替换为 _ 并且我的代谢物没有重复名称。但是,我不断收到相同的错误消息。

这是我来自控制台的代码和产生的错误消息:

ANOVA2fdr <- read.csv("C:/Users/earha/OneDrive/Metabolomics/Second Analysis/Analyses/AOVA2fdr/ANOVA2fdr.csv")
View(ANOVA2fdr)
library(MetaboAnalystR)
mSet<-InitDataObjects("conc", "ts", FALSE)

[1] "MetaboAnalyst R objects initialized ..."
Warning message:
In Cairo::CairoFonts(regular = "Arial:style=Regular", bold = "Arial:style=Bold",  :
CairoFonts() has no effect on Windows. Please use par(family="...") to specify the desired font - see ?par.

mSet<-SetDesignType(mSet, "g2")
mSet<-Read.TextData(mSet, ANOVA2fdr, "rowts", "disc");

<simpleError in data.table::fread(fileName, header = TRUE, check.names = FALSE,     blank.lines.skip = TRUE, data.table = FALSE): input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r>
[1] "Using slower file reader ..."
<simpleWarning in if (formatStr == "txt") {    dat <- try(read.table(fileName, header = TRUE, comment.char = "",         check.names = F, as.is = T))} else {    dat <- try(read.csv(fileName, header = TRUE, comment.char = "",         check.names = F, as.is = T))}: the condition has length > 1 and only the first element will be used>
[1] "Using slower file reader ..."
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
'file' must be a character string or connection
In addition: Warning message:
In if (formatStr == "txt") { :
he condition has length > 1 and only the first element will be used
[1] "Data format error. Failed to read in the data!"
[1] "Make sure the data table is saved as comma separated values (.csv) format!"
[1] "Please also check the followings: "
[1] "Either sample or feature names must in UTF-8 encoding; Latin, Greek letters are not allowed."
[1] "We recommend to use a combination of English letters, underscore, and numbers for naming purpose."
[1] "Make sure sample names and feature (peak, compound) names are unique."
[1] "Missing values should be blank or NA without quote."
[1] "Make sure the file delimeters are commas."

谢谢你尽你所能的帮助!

标签: rcsv

解决方案


推荐阅读