R system2命令没有结果

R system2命令没有结果,r,system2,R,System2,我有一个脚本,我正在使用它来分析R studio中的一些音频数据。脚本运行时没有错误,但是当我执行它时,它什么也不做。我认为这可能是system2命令的问题。非常感谢您的帮助,我甚至连一条错误信息都没有,真是不知所措 这是我的密码- # Set the directory containing the files directory <- "D://Alto//Audio 1//Day 2//" # The directory to store the results base_outpu

我有一个脚本,我正在使用它来分析R studio中的一些音频数据。脚本运行时没有错误,但是当我执行它时,它什么也不做。我认为这可能是system2命令的问题。非常感谢您的帮助,我甚至连一条错误信息都没有,真是不知所措

这是我的密码-

# Set the directory containing the files
directory <- "D://Alto//Audio 1//Day 2//"
# The directory to store the results
base_output_directory <- "D://Ecoacoustics//Output//indices_output//"

# Get a list of audio files inside the directory
# (Get-ChildItem is just like ls, or dir)
files <- list.files(directory, pattern = "*.wav", full.names = TRUE)

# iterate through each file
for(file in files) {
 message("Processing ", file) 

  # get just the name of the file
  file_name <- basename(file)

  # make a folder for results
  output_directory <- normalizePath(file.path(base_output_directory, file_name))
  dir.create(output_directory, recursive = TRUE)

  # prepare command
  command <- sprintf('audio2csv "%s" "Towsey.Acoustic.yml" "%s" ', file, output_directory)

  # finally, execute the command
  system2('C://Ecoacoustics//AnalysisPrograms//AnalysisPrograms.exe//', command) 
}
#设置包含文件的目录

您正在调用的目录是
system
而不是
system2
。它甚至会说“正在处理”吗?您确定
files
变量中有文件吗?
列表.files
中的
模式=
应该是一个正则表达式,而不是一个grob风格的表达式。为了清楚起见,您有一个名为“AnalysisPrograms.exe”的文件夹,其中包含一个名为“audio2csv”的程序?或者名为“AnalysisPrograms.exe”和“audio2csv”的程序是要传递给函数的参数?另外,
args=
实际上应该是参数的字符向量,而不是单个字符串。通过逐行运行脚本来检查每个对象。如前所述,
list.files
中的正则表达式看起来有点可疑。还可以尝试通过手动“迭代”来运行循环体。或者打印循环变量的值…也许您需要
shQuote
{base}您正在调用
system
而不是
system2
。它甚至会说“正在处理”吗?您确定
files
变量中有文件吗?
列表.files
中的
模式=
应该是一个正则表达式,而不是一个grob风格的表达式。为了清楚起见,您有一个名为“AnalysisPrograms.exe”的文件夹,其中包含一个名为“audio2csv”的程序?或者名为“AnalysisPrograms.exe”和“audio2csv”的程序是要传递给函数的参数?另外,
args=
实际上应该是参数的字符向量,而不是单个字符串。通过逐行运行脚本来检查每个对象。如前所述,
list.files
中的正则表达式看起来有点可疑。还可以尝试通过手动“迭代”来运行循环体。或者打印循环变量的值……也许您需要
shQuote
{base}