使用Drake for Rmd的“目标缺少文件”错误

时间:2019-12-08 06:43:40

标签: r tidyverse drake-r-package

今天就开始学习如何使用Drake,并设法迁移了我的代码,但还没有迁移我的R降价报告。该报告可以很好地编译,并产生预期的输出,但同时也会出现此错误,而没有进行大量搜索。

Error message from drake

我正在按照建议使用r_make()命令,到目前为止,我的计划为:

plan_0 <- drake_plan(
  raw_c_data = read_rds(
    file_in("data/css_carib_data.rds")),
  raw_c_fg = read_rds(
    file_in("data/css_carib_fg.rds")),
  c_data = clean_caribbean_fg(raw_c_data, raw_c_fg),
  clean_c_fg = write_rds(
    c_data,
    file_out("data/clean_c_fg.rds"),
    compress = "gz"),
  c_maps = gen_maps(bbx_1, bbx_2, bbx_3, bbx_4, bbx_5),
  c_maps_out = write_rds(
    c_maps,
    file_out("data/c_maps.rds"),
    compress = "gz"),
  c_base_report = rmarkdown::render(
    knitr_in("R/0_prepare_data.Rmd"),
    output_file = file_out("0_prepare_data.html"),
    quiet = T)
)

该Rmd文件以以下内容开头

---
title: "0: Data Description"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

require(drake)
require(tidyverse)
require(ggmap)

loadd(raw_c_fg)
loadd(clean_c_fg)
loadd(c_maps)
```

This document is a description of the data processed in `0_prepare_data.R` from the Caribbean region. The following table gives the counts of each classification within the aggregated functional groups.

```{r tables, echo = F}
raw_c_fg %>%
  pull(fg) %>%
  table() %>%
  knitr::kable(col.names = c("Class", "Count"),
               caption = "Counts of Each Functional Group")
```

我很乐意根据需要添加更多内容,但希望这足以说明为什么我会收到此错误?

1 个答案:

答案 0 :(得分:1)

找出问题所在,这是Rmd与Rproj / drake之间相对位置的通常冲突。我已经在R目录中找到Rmd文件,但是_drake.R在基本目录中,因此定位输出的差异导致了Drake在错误的位置查找。