windows 上的 r drake 文件路径搞砸了
r drake file paths on windows messed up
我正在尝试 运行 使用 drake 的项目。 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 使用 /
路径约定并处理得很好。但是不知怎么的,这里的路径乱七八糟,我不知道为什么。
这是已知的并且有可用的解决方法吗?有人知道错误是在哪里产生的,所以我可以在 drake 代码中修复它吗?
谢谢!
示例代码:
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)
在我的 Windows 10 机器上,您的示例运行没有错误。也许您使用的是旧版本的 drake
和 txtq
。如果是这样,您可以使用 install.packages()
升级它们。否则,make()
和 history = 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 package (v0.3.0)
于 2020-07-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
我正在尝试 运行 使用 drake 的项目。 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 使用 /
路径约定并处理得很好。但是不知怎么的,这里的路径乱七八糟,我不知道为什么。
这是已知的并且有可用的解决方法吗?有人知道错误是在哪里产生的,所以我可以在 drake 代码中修复它吗?
谢谢!
示例代码:
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)
在我的 Windows 10 机器上,您的示例运行没有错误。也许您使用的是旧版本的 drake
和 txtq
。如果是这样,您可以使用 install.packages()
升级它们。否则,make()
和 history = 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 package (v0.3.0)
于 2020-07-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