小编Mat*_*lle的帖子

knitr与交互式R行为

在我注意到knitr的作者建议的方法获得更多帮助后,我在这里重新发布我的问题.

我对.Rmd文件有点困惑,我可以在交互式R会话中逐行进行,也可以使用R CMD BATCH,但在使用时失败knit("test.Rmd").我不确定问题出在哪里,我试图尽可能地缩小问题范围.以下是示例(in test.Rmd):

```{r Rinit, include = FALSE, cache = FALSE}
opts_knit$set(stop_on_error = 2L)
library(adehabitatLT)
```

The functions to be used later:

```{r functions}
ld <- function(ltraj) {
    if (!inherits(ltraj, "ltraj")) 
        stop("ltraj should be of class ltraj")
    inf <- infolocs(ltraj)
    df <- data.frame(
        x = unlist(lapply(ltraj, function(x) x$x)),
        y = unlist(lapply(ltraj, function(x) x$y)),
        date = unlist(lapply(ltraj, function(x) x$date)),
        dx = unlist(lapply(ltraj, function(x) x$dx)),
        dy = unlist(lapply(ltraj, function(x) x$dy)),
        dist = unlist(lapply(ltraj, …
Run Code Online (Sandbox Code Playgroud)

interactive r knitr

6
推荐指数
1
解决办法
450
查看次数

标签 统计

interactive ×1

knitr ×1

r ×1