构建 R 包:未记录的 S4 类(已记录!)
Building R package: Undocumented S4 classes (it is documented!)
我正在用 "Reference Class" (RC) classes 构建一个 R 包。现在正在准备CRAN投稿
我的主要导出 class 如下所示:
#' Oceans 2.0 API Client Library
#'
#' Provides convenient & easy access to Ocean Networks Canada's data.
#' For detailed information and usage examples, visit our
#' \href{https://wiki.oceannetworks.ca/display/O2A/R+Client+Library}{official Documentation}.
#'
#' @name Onc
#' @field token character. User token
#' @field showInfo logical. Print verbose debug comments
#' @field timeout numeric. Number of seconds before a request to the API is canceled
#' @field baseUrl character. Base URL for API requests
#' @field outPath character. Output path for downloaded files
#'
#' @export Onc
#' @exportClass Onc
Onc <- setRefClass("Onc",
fields = list(
token = "character",
showInfo = "logical",
timeout = "numeric",
baseUrl = "character",
outPath = "character"
),
methods = list(
(...)
当我构建并检查我的包时,我收到以下警告:
Undocumented S4 classes:
‘Onc’ All user-level objects in a package (including S4 classes and methods) should have documentation entries. See chapter
‘Writing R documentation files’ in the ‘Writing R Extensions’ manual.
它甚至不是 S4 class,而是一个参考 class,我相信它有很好的文档记录。我如何通过此检查?
1个月后,我回答我自己的问题:
这是文档格式(作为 R 中的大多数新事物,文档格式很糟糕)。以下完美运行,请注意与原始文档字符串的区别:
#' Onc Class
#'
#' Provides convenient & easy access to Ocean Networks Canada's data.
#' For detailed information and usage examples, visit our
#' \href{https://wiki.oceannetworks.ca/display/O2A/R+Client+Library}{official Documentation}.
#'
#' @field token character. User token
#' @field showInfo logical. Print verbose debug comments
#' @field timeout numeric. Number of seconds before a request to the API is canceled
#' @field baseUrl character. Base URL for API requests
#' @field outPath character. Output path for downloaded files
#'
#' @exportClass Onc
Onc <- setRefClass("Onc",
fields = list(
我正在用 "Reference Class" (RC) classes 构建一个 R 包。现在正在准备CRAN投稿
我的主要导出 class 如下所示:
#' Oceans 2.0 API Client Library
#'
#' Provides convenient & easy access to Ocean Networks Canada's data.
#' For detailed information and usage examples, visit our
#' \href{https://wiki.oceannetworks.ca/display/O2A/R+Client+Library}{official Documentation}.
#'
#' @name Onc
#' @field token character. User token
#' @field showInfo logical. Print verbose debug comments
#' @field timeout numeric. Number of seconds before a request to the API is canceled
#' @field baseUrl character. Base URL for API requests
#' @field outPath character. Output path for downloaded files
#'
#' @export Onc
#' @exportClass Onc
Onc <- setRefClass("Onc",
fields = list(
token = "character",
showInfo = "logical",
timeout = "numeric",
baseUrl = "character",
outPath = "character"
),
methods = list(
(...)
当我构建并检查我的包时,我收到以下警告:
Undocumented S4 classes: ‘Onc’ All user-level objects in a package (including S4 classes and methods) should have documentation entries. See chapter ‘Writing R documentation files’ in the ‘Writing R Extensions’ manual.
它甚至不是 S4 class,而是一个参考 class,我相信它有很好的文档记录。我如何通过此检查?
1个月后,我回答我自己的问题:
这是文档格式(作为 R 中的大多数新事物,文档格式很糟糕)。以下完美运行,请注意与原始文档字符串的区别:
#' Onc Class
#'
#' Provides convenient & easy access to Ocean Networks Canada's data.
#' For detailed information and usage examples, visit our
#' \href{https://wiki.oceannetworks.ca/display/O2A/R+Client+Library}{official Documentation}.
#'
#' @field token character. User token
#' @field showInfo logical. Print verbose debug comments
#' @field timeout numeric. Number of seconds before a request to the API is canceled
#' @field baseUrl character. Base URL for API requests
#' @field outPath character. Output path for downloaded files
#'
#' @exportClass Onc
Onc <- setRefClass("Onc",
fields = list(