小编Sca*_*ett的帖子

在 R 中,不能在包 Vignette 文件中编出相同的代码。“列表”对象不能被强制为整数类型

这个问题是关于包 GRATIS 中的 generate_msts() 函数。

我添加了一些新东西(使函数可以选择将其输出转换为可爱的 tsibble 格式或保留原始的“列表”格式)并准备更新到 CRAN。

新代码添加如下(代码的详细信息以及问题底部显示的示例)

我想知道我应该得到 tsibble 索引吗?但是生成的数据好像没有索引?

  output <- if (output_format == "list") {
    res                                    #this is output name defined before
  } else if (output_format == "tsibble") {
    as_tsibble(res)
  }
  return(output)
}
Run Code Online (Sandbox Code Playgroud)

作为指导,我在Vignette 中更新了此函数的相应示例。然后事情变得连贯起来。

如果我没有保存生成的时间序列输出(例如 x <- my_function()),则小插图 无法编织。(不过我可以在独立的普通RMD文件中直接使用这个功能)

直接使用这段代码可以在RStudio里面显示输出,但是不能编出来。

my_function(seasonal.periods = c(7, 365), n = 800, nComp = 2,output_format="tsibble")
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

Error in Fun(X[[i]],...): 'list' object cannot be coerced to type 'integer' Calls: <Anonymous>... 
as.data.frame -> head  -> head.data.frame -> lappy -> …
Run Code Online (Sandbox Code Playgroud)

vignette r function tsibble

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

Unexported object imported by a ':::' call: 'tsfeatures:::scalets'

After doing devtools::check(cran=TRUE) I got this warning. I saw others say we cannot use ":::" on CRAN. So, how to fix this problem? Thank you for helping!

> checking dependencies in R code ... NOTE
  Unexported object imported by a ':::' call: 'tsfeatures:::scalets'
    See the note in ?`:::` about the use of this operator.
Run Code Online (Sandbox Code Playgroud)

r package

4
推荐指数
1
解决办法
207
查看次数

标签 统计

r ×2

function ×1

package ×1

tsibble ×1

vignette ×1