0

我试图用德雷克运行一个项目。make(plan)运行良好,但在计划的最后一点之后我收到一个错误。

Error in file(private$total_file, "r+w") : cannot open connection
Additional Warning:
In file(private$total_file, "r+w") :
'C:\R_project\.drake/drake/history/total' cannot open file: Invalid argument

我在 Windows 系统上运行(带有\\路径分隔符)。通常,R 使用/路径约定并处理得很好。但不知何故,这里的路径搞砸了,我不知道为什么。

这是已知的并且有可用的解决方法吗?有人知道错误是在哪里产生的,所以我可以在德雷克代码中修复它吗?

谢谢!

示例代码:

plan2 = drake_plan(
  loadRequirements =   {
    library(ggplot2)
  }
)
vis_drake_graph(plan2)
make(plan2)

traceback() 的输出

> traceback()
20: file(private$total_file, "r+w")
19: private$txtq_inc_total(length(out))
18: private$txtq_push(title = title, message = message)
17: force(code)
16: private$txtq_exclusive(private$txtq_push(title = title, message = message))
15: config$cache$history$push(title = target, message = meta_hash)
14: store_meta(target = target, value = value, meta = meta, hash = hash, 
        config = config)
13: store_item(target = target, value = value, meta = meta, config = config)
12: store_outputs(target = target, value = value, meta = meta, config = config)
11: conclude_build_impl.default(value, target, meta, config)
10: conclude_build_impl(value, target, meta, config)
9: conclude_build(build, config)
8: local_build(target = targets[1], config = config, downstream = targets[-1])
7: loop_check(config)
6: drake_backend_loop(config)
5: drake_backend(config)
4: run_backend(config)
3: process_targets(config)
2: make_impl(config)
1: make(plan)
4

1 回答 1

1

在我的 Windows 10 机器上,您的示例运行没有错误。也许您正在使用旧版本的draketxtq。如果是这样,您可以使用install.packages(). 否则,make()withhistory = FALSE应该避免这个问题。

library(drake)
plan <- drake_plan(
  loadRequirements = {
    library(ggplot2)
  }
)
vis_drake_graph(plan)

make(plan)
#> i Consider drake::r_make() to improve robustness.
#> > target loadRequirements

reprex 包(v0.3.0)于 2020 年 7 月 28 日创建

会话信息
sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18363)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.1252 
#> [2] LC_CTYPE=English_United States.1252   
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggplot2_3.3.2 drake_7.12.4 
#> 
#> loaded via a namespace (and not attached):
#>  [1] storr_1.2.1       progress_1.2.2    tidyselect_1.1.0  xfun_0.16        
#>  [5] purrr_0.3.4       colorspace_1.4-1  vctrs_0.3.2       generics_0.0.2   
#>  [9] htmltools_0.5.0   yaml_2.2.1        rlang_0.4.7       pillar_1.4.6     
#> [13] txtq_0.2.3        glue_1.4.1        withr_2.2.0       lifecycle_0.2.0  
#> [17] stringr_1.4.0     munsell_0.5.0     gtable_0.3.0      visNetwork_2.0.9 
#> [21] htmlwidgets_1.5.1 evaluate_0.14     knitr_1.29        callr_3.4.3      
#> [25] ps_1.3.3          curl_4.3          parallel_4.0.2    fansi_0.4.1      
#> [29] highr_0.8         Rcpp_1.0.5        backports_1.1.8   scales_1.1.1     
#> [33] filelock_1.0.2    webshot_0.5.2     jsonlite_1.7.0    mime_0.9         
#> [37] hms_0.5.3         digest_0.6.25     stringi_1.4.6     processx_3.4.3   
#> [41] dplyr_1.0.0       grid_4.0.2        cli_2.0.2         tools_4.0.2      
#> [45] magrittr_1.5      base64url_1.4     tibble_3.0.3      crayon_1.3.4     
#> [49] pkgconfig_2.0.3   ellipsis_0.3.1    xml2_1.3.2        prettyunits_1.1.1
#> [53] lubridate_1.7.9   httr_1.4.2        assertthat_0.2.1  rmarkdown_2.3    
#> [57] R6_2.4.1          igraph_1.2.5      compiler_4.0.2
于 2020-07-28T12:57:45.900 回答