From 0fdc3201b84a8512077a9e24bd62154fdda07adc Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Mon, 3 Jun 2024 09:48:16 -0500 Subject: [PATCH] Fix documentation issues The try.xts() example was more than 100 characters wide, which threw a warning in R CMD check. The [timeSeries] link was malformed because it was missing the second component with package reference. --- R/reclass.R | 2 +- R/xts.R | 5 +++-- man/as.xts.Rd | 5 +++-- man/reclass.Rd | 10 +--------- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/R/reclass.R b/R/reclass.R index 7eecdc5..2a028b7 100644 --- a/R/reclass.R +++ b/R/reclass.R @@ -114,7 +114,7 @@ use.xts <- try.xts #' try.xts(a, error = FALSE) # fails silently, still an integer vector #' #' # control the result with a function -#' try.xts(a, error = function(x, ...) { paste0("I'm sorry ", Sys.info()[["user"]], ", I'm afraid I can't do that.") }) +#' try.xts(a, error = function(x, ...) { "I'm afraid I can't do that." }) #' #' z <- zoo(1:10, timeBasedSeq("2020-01-01/2020-01-10")) #' diff --git a/R/xts.R b/R/xts.R index 1ab7be9..2602553 100644 --- a/R/xts.R +++ b/R/xts.R @@ -412,8 +412,9 @@ function(x) { #' format for use within \R. #' #' `as.xts()` can convert objects of the following classes into an xts object: -#' object: [timeSeries], [ts], [matrix], [data.frame], and [zoo]. `xtsible()` -#' safely checks whether an object can be converted to an xts object. +#' object: [timeSeries][timeSeries::timeSeries], [ts], [matrix], [data.frame], +#' and [zoo]. `xtsible()` safely checks whether an object can be converted to +#' an xts object. #' #' Additional `name = value` pairs may be passed to the function to be added to #' the new object. A special [`print.xts()`] method ensures the attributes are diff --git a/man/as.xts.Rd b/man/as.xts.Rd index cb89582..f3d3ac4 100644 --- a/man/as.xts.Rd +++ b/man/as.xts.Rd @@ -92,8 +92,9 @@ A simple and reliable way to convert many different objects into a uniform format for use within \R. \code{as.xts()} can convert objects of the following classes into an xts object: -object: \link{timeSeries}, \link{ts}, \link{matrix}, \link{data.frame}, and \link{zoo}. \code{xtsible()} -safely checks whether an object can be converted to an xts object. +object: \link[timeSeries:timeSeries]{timeSeries}, \link{ts}, \link{matrix}, \link{data.frame}, +and \link{zoo}. \code{xtsible()} safely checks whether an object can be converted to +an xts object. Additional \code{name = value} pairs may be passed to the function to be added to the new object. A special \code{\link[=print.xts]{print.xts()}} method ensures the attributes are diff --git a/man/reclass.Rd b/man/reclass.Rd index b0b4385..c7af182 100644 --- a/man/reclass.Rd +++ b/man/reclass.Rd @@ -79,21 +79,13 @@ a <- 1:10 try.xts(a, error = FALSE) # fails silently, still an integer vector # control the result with a function -try.xts(a, error = function(x, ...) { paste0("I'm sorry ", Sys.info()[["user"]], ", I'm afraid I can't do that.") }) +try.xts(a, error = function(x, ...) { "I'm afraid I can't do that." }) z <- zoo(1:10, timeBasedSeq("2020-01-01/2020-01-10")) str(try.xts(z)) # zoo to xts str(reclass(as.xts(z))) # reclass back to zoo -#add <- function(x, ...) { -# print(class(x)) -# x + 21 -#} -#add_ts <- Reclass(add) -#z_plus <- add_ts(z) # will print "xts" -#class(z_plus) # still zoo! - } \seealso{ \code{\link[=as.xts]{as.xts()}}