无法加载R包数据

时间:2017-03-01 13:07:54

标签: r namespaces packages

我开发了一个R软件包,但由于某种原因,当软件包进行了氧化和安装时,与软件包一起使用的数据集没有正确加载。我在包的R文件夹中有一个.R脚本,看起来像这样

#' Score Card
#' @docType data
#' @name scoreCard
#' @aliases scoreCard
#' @format An object of class \code{data.frame} with 119 rows and 3 columns.
#' \describe{
#'   \item{Category}{The Category for which an observation is made}
#'   \item{Observation}{The possible responses given for each category}
#'   \item{Score}{The score allocated against a response for each category}
#' }
#' @source Internal
#' @usage scoreCard
#' @keywords datasets
NULL

这会在调用Roxygenise时为数据集创建.Rmd文件,但当我尝试使用packageName::scoreCard调用数据集时,它会指定'scoreCard' is not an exported object from 'namespace:packageName'。任何人都可以发现我在上面的剧本中可能做错了什么或者可能出错的任何其他想法,我有点亏本吗? (数据集按正常情况存储在软件包的数据文件夹中。)我不能分享数据或软件包。抱歉。

1 个答案:

答案 0 :(得分:5)

对,我没有意识到我需要LazyData:在我的描述文件中为true。应该更仔细地阅读:http://r-pkgs.had.co.nz/data.html