MatthieuStigler / matPkg

Other
2 stars 0 forks source link

Error in: mat_99_run_Rfiles(run_function = "external") #65

Closed MatthieuStigler closed 2 years ago

MatthieuStigler commented 2 years ago

Now that we are passing well the argument, this revealed a bug:

Caused by error in which(error_line_pos):(which(backtrace_line_pos) - 1):

library(matPkg)
packageVersion("matPkg")
#> [1] '0.2.1.903'

## read
path_rscripts <- system.file("r_scripts_fake", package = "matPkg")
dir_dat <- subset(mat_99_list_Rfiles(path_rscripts), filename=="1_3_light_error_rLoE.R")

## works
out_internal <- mat_99_run_Rfiles(dir_dat, run_function = "internal", echo=TRUE)
#> 
#> Doing file:  1_3_light_error_rLoE.R
#> Timing stopped at: 0.032 0 0.032
#>  -Memory:  before: 200 MB, after: 200 MB, diff: 1 MB, final: 200 MB 
#>  -Approx time:  <1 Sec 
#>  -ERROR:  Can't subset columns that don't exist.✖ Column `lk` doesn't exist. 
#>  -Done with file /home/matifou/R/x86_64-pc-linux-gnu-library/4.2/matPkg/r_scripts_fake/1_3_light_error_rLoE.R

## ✖ doesn't work ✖
out_external <- mat_99_run_Rfiles(dir_dat, run_function = "external", echo=TRUE)
#> 
#> Doing file:  1_3_light_error_rLoE.R
#> Error in `mutate()`:
#> ! Problem while computing `try = map(.data$full_path, ~run_function(.,
#>   echo = echo))`.
#> Caused by error in `which(error_line_pos):(which(backtrace_line_pos) - 1)`:
#> ! argument of length 0

## isolate error:
matPkg:::source_rcmd_batch(path=dir_dat$full_path[[1]])
#> 
#> Doing file:  1_3_light_error_rLoE.R
#> Error in which(error_line_pos):(which(backtrace_line_pos) - 1): argument of length 0

Created on 2022-10-02 by the reprex package (v2.0.1)