Невозможно отобразить дистиллированную статью в целевом конвейере
Я новичок в целевой экосистеме. Я не смог создать дистиллят из моего целевого конвейера, хотя он работает, когда я устанавливаю вывод на
html_document
в ямл. Я пробовал погуглить, но ничего полезного не нашел. Любая помощь будет оценена по достоинству.
У меня RStudio версии 1.4.1717. Я получил это сообщение об ошибке при запуске
tar_make()
:
Error: callr subprocess failed: Distill articles cannot be previewed in this version of RStudio.
Please update to version 1.2.718 or higher at https://www.rstudio.com/products/rstudio/download/
Visit https://books.ropensci.org/targets/debugging.html for debugging advice.
Run `rlang::last_error()` to see where the error occurred.
Вот минимальный пример кода.
Код в
_targets.R
library(targets)
library(tarchetypes)
tar_plan(
tar_target(dat, iris),
tar_render(test_report, "test.Rmd")
)
Вот содержимое моего файла Rmd. Большинство из них взяты из шаблона.
---
title: "Test"
description: |
A new article created using the Distill format.
author:
- name: Nora Jones
url: https://example.com/norajones
affiliation: Spacely Sprockets
affiliation_url: https://example.com/spacelysprokets
date: "`r Sys.Date()`"
output: distill::distill_article
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r load-targets, include=FALSE}
tar_load(dat)
```
```{r}
summary(dat)
```
Информация о сеансе
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] igraph_1.2.6 rstudioapi_0.13 knitr_1.33 magrittr_2.0.1 tidyselect_1.1.1
[6] R6_2.5.1 rlang_0.4.11 fansi_0.5.0 tools_4.1.0 targets_0.7.0
[11] data.table_1.14.0 xfun_0.25 utf8_1.2.2 cli_3.0.1 withr_2.4.2
[16] ellipsis_0.3.2 yaml_2.2.1 digest_0.6.27 tibble_3.1.3 lifecycle_1.0.0
[21] crayon_1.4.1 processx_3.5.2 purrr_0.3.4 callr_3.7.0 vctrs_0.3.8
[26] ps_1.6.0 codetools_0.2-18 glue_1.4.2 compiler_4.1.0 pillar_1.6.2
[31] pkgconfig_2.0.3
1 ответ
I've been having the same issue.
From here you can see that checks for the version first by trying the
rstudioapi
(which fails) and then by looking for an environment variable called "RSTUDIO_VERSION", which does not exist on my system. When this fails, it uses a default value of 1.1, which fails the check of having at least version 1.2.7...
There is a simple, if slightly hacky, solution which is to just manually set the environment variable that
distill
is looking for at the top of your script. I.e., your Rmd file would become:
---
title: "Test"
description: |
A new article created using the Distill format.
author:
- name: Nora Jones
url: https://example.com/norajones
affiliation: Spacely Sprockets
affiliation_url: https://example.com/spacelysprokets
date: "`r Sys.Date()`"
output: distill::distill_article
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
# Add environment variable
Sys.setenv("RSTUDIO_VERSION" = '1.4.1725')
```
```{r load-targets, include=FALSE}
tar_load(dat)
```
```{r}
summary(dat)
```
This works totally fine for me. If you're worried about this having ongoing effects, you can remove it afterwards (
Sys.unsetenv("RSTUDIO_VERSION")
)