繁体   English   中英

使用if()时的警告消息

[英]Warning Message when using if()

我正在尝试对多个文件执行一个函数,我正在使用它:

require(readxl);
require(MESS);
final_df <- NULL;
for(i in CHI.Files){
  PPeakD <- read_excel(paste0('/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/',i), sheet = "Ppeak");
  PPeakD <- PPeakD[c(4,5)]
  colnames(PPeakD)<-c("Time","PPeak")
  PPeakD <- PPeakD[c(which(PPeak$PPeak>0)),]

  PEEP <- read_excel(paste0("~/Dropbox/Research/Andrew/
                     LungStudyOutput - Whole case/",i), 
                     sheet = "PEEP")
  PEEP <- PEEP[c(4,5)]
  colnames(PEEP)<-c("Time","PEEP")
  PEEP <- PEEP[c(which(PEEP$PEEP>0)),]

  PPeakAdj <- CHI.Files.frame(approx(PPeak$Time, PPeak$PPeak, 
                                     xout = PEEP$Time, method = "linear", rule = 2))
  colnames(PPeakAdj)<-c("Time","PPeakAdj")

  DrivP <- CHI.Files.frame((PPeakAdj$Time),((c(PPeakAdj$PPeakAdj)) - (c(PEEP$PEEP))))
  colnames(DrivP) <- c("Time", "DrivP")
  final_df <- rbind(final_df,DrivP)
}

但是,当我这样做时,我只收到以下消息:

In addition: Warning messages:
1: In if (!file.exists(path)) { :
  the condition has length > 1 and only the first element will be used
2: In if (!is_absolute_path(path)) paste0(" in current working directory ('",  :
  the condition has length > 1 and only the first element will be used

寻找关于我做错的任何建议?

谢谢

编辑:制作@Jonathan Carroll的修正错误代码如下:

 Error: '/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/013234-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/006538-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/000478-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/025396-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/045495-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/000443-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/020462-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/
                           LungStudyOutput - Whole case/080677-1.xls/Users/andrewmclean/Dropbox/Research/Andrew/

In addition: Warning messages:
1: In if (!file.exists(path)) { :
  the condition has length > 1 and only the first element will be used
2: In if (!is_absolute_path(path)) paste0(" in current working directory ('",  :
  the condition has length > 1 and only the first element will be used

据推测,这应该有一个paste其内容,因为它目前正试图提供太多的参数

PEEP <- read_excel("~/Dropbox/Research/Andrew/
                 LungStudyOutput - Whole case/",CHI.Files[i], sep='', 
                 sheet = "PEEP")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM