【发布时间】:2019-05-14 01:56:51
【问题描述】:
我正在尝试构建一个依赖于其他包的玩具包。我当前的包构建,我可以library() 加载包,运行唯一的功能,它工作正常。但是,当我在包上运行“检查”时(在 RStudio 中),我在包依赖项jsonlite 上得到一个错误结果,我的代码中没有这个结果。我以前有,但删除了它,并从 gui 进行了清理和重建。这是Check的输出:
── R CMD check results ──────────────────────────────── hydrocracking 0.1.0 ────
Duration: 11.9s
❯ checking package dependencies ... ERROR
Namespace dependency not required: ‘jsonlite’
See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
manual.
这将被缓存在哪里?据我了解,这是我的 3 个重要文件的当前状态:
R/你好.R:
#' Main call
#'
#' Main call to create sqrt call
#'
#' @param x Number to take sqrt of
#'
#' @return Number
#'
#' @import tidyverse
#'
#' @export
hello <- function(x) {
x %>% sqrt()
}
描述:
Package: hydrocracking
Type: Package
Title: What the Package Does (Title Case)
Version: 0.1.0
Author: me
Maintainer: The package maintainer <yourself@somewhere.net>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
Depends:
tidyverse
License: What license is it under?
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.0
命名空间:
# Generated by roxygen: do not edit by hand
export(hello)
import(tidyverse)
再次,包加载,函数调用工作......我只是不明白Check失败:
library(hydrocracking)
hello(2)
#>[1] 1.414214
【问题讨论】:
-
您最初是如何设置软件包的?与
devtools::create()?您是否尝试过退出 RStudio,重新启动它,然后运行 check()? -
嗨@duckmayr——我通过RStudio使用包向导设置了它。但是一个完整的 RStuido 重启似乎已经修复了它。将发布解决方案并参考您,谢谢。
-
这是一个 RStudio 问题,请将其标记为此类。退出和重新启动应该始终是您尝试的第二件事,尤其是。当您怀疑 RStudio 而不是底层的 R 命令时。