From 97a0f848f58d963a6d9adfa1769cd8414ab71044 Mon Sep 17 00:00:00 2001 From: Kyle Husmann Date: Mon, 17 Jun 2024 15:15:34 -0700 Subject: [PATCH] create man pages for cfactor and interlaced attribute setters --- R/cfactor.R | 7 ++++++- R/interlaced.R | 6 ++++-- man/codes-set.Rd | 15 +++++++++++++++ man/codes.Rd | 4 ---- man/levels-set-.interlacer_interlaced.Rd | 18 ++++++++++++++++++ man/levels.interlacer_interlaced.Rd | 4 ---- 6 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 man/codes-set.Rd create mode 100644 man/levels-set-.interlacer_interlaced.Rd diff --git a/R/cfactor.R b/R/cfactor.R index 66416c1..eb9f4ff 100644 --- a/R/cfactor.R +++ b/R/cfactor.R @@ -117,8 +117,13 @@ codes.default <- function(x, ...) { attr(attr(x, "levels"), "codes") } -#' @rdname codes +#' Set the codes for a `cfactor`` +#' +#' Set the codes for a `cfactor`, similar to `levels<-()` +#' #' @keywords internal +#' @param value a named vector of codes for the `cfactor` +#' #' @export `codes<-` <- function(x, value) { UseMethod("codes") diff --git a/R/interlaced.R b/R/interlaced.R index e8558ad..eca239a 100644 --- a/R/interlaced.R +++ b/R/interlaced.R @@ -493,6 +493,9 @@ levels.interlacer_interlaced <- function(x) { levels(value_channel(x)) } +#' Set the factor level attributes of `interlaced` vectors +#' @keywords internal +#' @param value A vector of new levels to set #' @export `levels<-.interlacer_interlaced` <- function(x, value) { map_value_channel(x, \(v) `levels<-`(v, value)) @@ -504,8 +507,7 @@ na_levels <- function(x) { levels(na_channel(x)) } -#' @rdname levels.interlacer_interlaced -#' @keywords internal +#' @rdname levels-set-.interlacer_interlaced #' @export `na_levels<-` <- function(x, value) { map_na_channel(x, \(v) `levels<-`(v, value)) diff --git a/man/codes-set.Rd b/man/codes-set.Rd new file mode 100644 index 0000000..1c37165 --- /dev/null +++ b/man/codes-set.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cfactor.R +\name{codes<-} +\alias{codes<-} +\title{Set the codes for a `cfactor``} +\usage{ +codes(x) <- value +} +\arguments{ +\item{value}{a named vector of codes for the \code{cfactor}} +} +\description{ +Set the codes for a \code{cfactor}, similar to \verb{levels<-()} +} +\keyword{internal} diff --git a/man/codes.Rd b/man/codes.Rd index 167a92c..9fad6f2 100644 --- a/man/codes.Rd +++ b/man/codes.Rd @@ -2,14 +2,11 @@ % Please edit documentation in R/cfactor.R \name{codes} \alias{codes} -\alias{codes<-} \alias{levels.interlacer_cfactor} \title{\code{cfactor} attributes} \usage{ codes(x, ...) -codes(x) <- value - \method{levels}{interlacer_cfactor}(x) } \arguments{ @@ -25,4 +22,3 @@ for the \code{cfactor} \description{ Return the levels or codes of a \code{cfactor} } -\keyword{internal} diff --git a/man/levels-set-.interlacer_interlaced.Rd b/man/levels-set-.interlacer_interlaced.Rd new file mode 100644 index 0000000..1927b5e --- /dev/null +++ b/man/levels-set-.interlacer_interlaced.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/interlaced.R +\name{levels<-.interlacer_interlaced} +\alias{levels<-.interlacer_interlaced} +\alias{na_levels<-} +\title{Set the factor level attributes of \code{interlaced} vectors} +\usage{ +\method{levels}{interlacer_interlaced}(x) <- value + +na_levels(x) <- value +} +\arguments{ +\item{value}{A vector of new levels to set} +} +\description{ +Set the factor level attributes of \code{interlaced} vectors +} +\keyword{internal} diff --git a/man/levels.interlacer_interlaced.Rd b/man/levels.interlacer_interlaced.Rd index 7d2019f..85757cc 100644 --- a/man/levels.interlacer_interlaced.Rd +++ b/man/levels.interlacer_interlaced.Rd @@ -3,14 +3,11 @@ \name{levels.interlacer_interlaced} \alias{levels.interlacer_interlaced} \alias{na_levels} -\alias{na_levels<-} \title{Factor level attributes of \code{interlaced} vectors} \usage{ \method{levels}{interlacer_interlaced}(x) na_levels(x) - -na_levels(x) <- value } \arguments{ \item{x}{an \code{interlaced} vector} @@ -24,4 +21,3 @@ when the value channel is a factor type, \code{levels()} will return its levels. Similarly \code{na_levels()} will return the levels for the missing reason channel. } -\keyword{internal}