【发布时间】:2017-07-23 23:52:37
【问题描述】:
我使用本教程制作了一个 Rexec 文件: http://www.r-datacollection.com/blog/Making-R-files-executable/
当我打开 Rstudio 并运行它时,我使用一个文件一直运行它。但是,我制作的 Rexec 文件运行到第一个 csv,然后停止。有没有办法将 Rexec 文件保留为一个文件并让所有 csvs 运行,还是必须成为多个文件?
有问题的代码存在于一个文件中,是这样的:
#Measure the time taken
start.time <- Sys.time()
# Load functions in other R files
source("R/Functions.R")
source("R/Negatives Check.R")
source("R/Control Totals.R")
source("R/Validations.R")
# Load Packages
load_packages()
files = load_TZP()
files2 = load_TZP_stacked()
# Negatives Check---------------------------------------------------------------
write_csv(cbind(Name = names(files), create_output()),
paste0("Final CSV/Negatives Check ", gsub(":", ".", Sys.time()), ".csv"))
这是 .Rexec 文件停止的地方
# Control Totals Check----------------------------------------------------------
# Choose limit to account for rounding
total_limit = 10
write_csv(cbind(#Name = control_total_files,
#Check = control_total_checks,
create_output_totals()),
paste0("Final CSV/Control Totals ", gsub(":", ".", Sys.time()), ".csv"))
# Validations Check-------------------------------------------------------------
# Choose a limit for the difference, to account for rounding errors
limit = 0.1
write_csv(cbind(Name = valid_names,
Check = valid_checks,
create_output_geo()),
paste0("Final CSV/Validations ", gsub(":", ".", Sys.time()), ".csv"))
# Measure the time taken
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken
【问题讨论】: