From c8aec6a862c8b4210420f9376217a89348959829 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Tue, 3 Dec 2024 15:13:24 -0800 Subject: [PATCH] Documents m_*length* as methods --- NAMESPACE | 1 + R/fimsframe.R | 47 ++++++++++--------- ...e_to_length_conversion-FIMSFrame-method.Rd | 18 ------- man/m_age_to_length_conversion.Rd | 21 ++++++--- man/m_lengthcomp-FIMSFrame-method.Rd | 16 ------- man/m_lengthcomp.Rd | 18 +++++-- 6 files changed, 54 insertions(+), 67 deletions(-) delete mode 100644 man/m_age_to_length_conversion-FIMSFrame-method.Rd delete mode 100644 man/m_lengthcomp-FIMSFrame-method.Rd diff --git a/NAMESPACE b/NAMESPACE index 07f25d9f..fa40206b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -54,6 +54,7 @@ export(update_parameters) exportMethods(Math) exportMethods(Ops) exportMethods(Summary) +exportMethods(m_age_to_length_conversion) exportMethods(m_agecomp) exportMethods(m_index) exportMethods(m_landings) diff --git a/R/fimsframe.R b/R/fimsframe.R index dc27370d..e057ea97 100644 --- a/R/fimsframe.R +++ b/R/fimsframe.R @@ -221,22 +221,24 @@ setMethod( } ) -#' Get the length-composition data to be used in the model +#' Get the length-composition data from a FIMSFrame object #' -#' @param x The object containing the length-composition data. -#' @param fleet_name The name of the fleet for the length-composition data. +#' @param x A FIMSFrame object with length-composition data. +#' @param fleet_name A string providing the name of the fleet for which you +#' want the length-composition data for. Technically, you can pass it a +#' vector of strings but it is more common to pass it a single string. +#' @return +#' A vector of length-composition data. The order of the vector is the order +#' the data frame was in before this function was called because it is just +#' extracting a column. #' @export +#' @rdname m_lengthcomp setGeneric( "m_lengthcomp", function(x, fleet_name) standardGeneric("m_lengthcomp") ) -# Should we add name as an argument here? - -#' Get the length-composition data data to be used in the model -#' -#' @param x The FIMSFrame containing length-composition data. -#' @param fleet_name The name of the fleet for the length-composition data. #' @export +#' @rdname m_lengthcomp setMethod( "m_lengthcomp", "FIMSFrame", @@ -244,30 +246,29 @@ setMethod( dplyr::filter( .data = x@data, .data[["type"]] == "length", - .data[["name"]] == fleet_name + .data[["name"]] %in% fleet_name ) |> dplyr::pull(.data[["value"]]) } ) -#' Get the age-to-length-conversion data to be used in the model +#' Get the age-to-length-conversion data from a FIMSFrame object #' -#' @param x The object containing the age-to-length-conversion data (i.e., -#' proportion of age "a" that are length "l"). -#' @param fleet_name A string specifying the name of the fleet that you want -#' data for. +#' @param x A FIMSFrame object with age-to-length-conversion data (i.e., +#' the proportion of age "a" that are length "l"). +#' @inheritParams m_lengthcomp +#' @return +#' A vector of age-to-length-conversion data. The order of the vector is the +#' order the data frame was in before this function was called because it is +#' just extracting a column. #' @export +#' @rdname m_age_to_length_conversion setGeneric( "m_age_to_length_conversion", function(x, fleet_name) standardGeneric("m_age_to_length_conversion") ) - -#' Get the age-to-length-conversion matrix to be used in the model -#' -#' @param x The object containing the age-to-length-conversion data (i.e., -#' proportion of age "a" that are length "l"). -#' @param fleet_name A string specifying the name of the fleet that you want -#' data for. +#' @export +#' @rdname m_age_to_length_conversion setMethod( "m_age_to_length_conversion", "FIMSFrame", @@ -276,7 +277,7 @@ setMethod( dplyr::filter( .data = as.data.frame(x@data), .data[["type"]] == "age-to-length-conversion", - .data[["name"]] == fleet_name + .data[["name"]] %in% fleet_name ) |> dplyr::group_by(.data[["age"]], .data[["length"]]) |> dplyr::summarize( diff --git a/man/m_age_to_length_conversion-FIMSFrame-method.Rd b/man/m_age_to_length_conversion-FIMSFrame-method.Rd deleted file mode 100644 index 2f781927..00000000 --- a/man/m_age_to_length_conversion-FIMSFrame-method.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fimsframe.R -\name{m_age_to_length_conversion,FIMSFrame-method} -\alias{m_age_to_length_conversion,FIMSFrame-method} -\title{Get the age-to-length-conversion matrix to be used in the model} -\usage{ -\S4method{m_age_to_length_conversion}{FIMSFrame}(x, fleet_name) -} -\arguments{ -\item{x}{The object containing the age-to-length-conversion data (i.e., -proportion of age "a" that are length "l").} - -\item{fleet_name}{A string specifying the name of the fleet that you want -data for.} -} -\description{ -Get the age-to-length-conversion matrix to be used in the model -} diff --git a/man/m_age_to_length_conversion.Rd b/man/m_age_to_length_conversion.Rd index 27914f8e..916e6df2 100644 --- a/man/m_age_to_length_conversion.Rd +++ b/man/m_age_to_length_conversion.Rd @@ -2,17 +2,26 @@ % Please edit documentation in R/fimsframe.R \name{m_age_to_length_conversion} \alias{m_age_to_length_conversion} -\title{Get the age-to-length-conversion data to be used in the model} +\alias{m_age_to_length_conversion,FIMSFrame-method} +\title{Get the age-to-length-conversion data from a FIMSFrame object} \usage{ m_age_to_length_conversion(x, fleet_name) + +\S4method{m_age_to_length_conversion}{FIMSFrame}(x, fleet_name) } \arguments{ -\item{x}{The object containing the age-to-length-conversion data (i.e., -proportion of age "a" that are length "l").} +\item{x}{A FIMSFrame object with age-to-length-conversion data (i.e., +the proportion of age "a" that are length "l").} -\item{fleet_name}{A string specifying the name of the fleet that you want -data for.} +\item{fleet_name}{A string providing the name of the fleet for which you +want the length-composition data for. Technically, you can pass it a +vector of strings but it is more common to pass it a single string.} +} +\value{ +A vector of age-to-length-conversion data. The order of the vector is the +order the data frame was in before this function was called because it is +just extracting a column. } \description{ -Get the age-to-length-conversion data to be used in the model +Get the age-to-length-conversion data from a FIMSFrame object } diff --git a/man/m_lengthcomp-FIMSFrame-method.Rd b/man/m_lengthcomp-FIMSFrame-method.Rd deleted file mode 100644 index 6595daf5..00000000 --- a/man/m_lengthcomp-FIMSFrame-method.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/fimsframe.R -\name{m_lengthcomp,FIMSFrame-method} -\alias{m_lengthcomp,FIMSFrame-method} -\title{Get the length-composition data data to be used in the model} -\usage{ -\S4method{m_lengthcomp}{FIMSFrame}(x, fleet_name) -} -\arguments{ -\item{x}{The FIMSFrame containing length-composition data.} - -\item{fleet_name}{The name of the fleet for the length-composition data.} -} -\description{ -Get the length-composition data data to be used in the model -} diff --git a/man/m_lengthcomp.Rd b/man/m_lengthcomp.Rd index 2b26535e..f88cd905 100644 --- a/man/m_lengthcomp.Rd +++ b/man/m_lengthcomp.Rd @@ -2,15 +2,25 @@ % Please edit documentation in R/fimsframe.R \name{m_lengthcomp} \alias{m_lengthcomp} -\title{Get the length-composition data to be used in the model} +\alias{m_lengthcomp,FIMSFrame-method} +\title{Get the length-composition data from a FIMSFrame object} \usage{ m_lengthcomp(x, fleet_name) + +\S4method{m_lengthcomp}{FIMSFrame}(x, fleet_name) } \arguments{ -\item{x}{The object containing the length-composition data.} +\item{x}{A FIMSFrame object with length-composition data.} -\item{fleet_name}{The name of the fleet for the length-composition data.} +\item{fleet_name}{A string providing the name of the fleet for which you +want the length-composition data for. Technically, you can pass it a +vector of strings but it is more common to pass it a single string.} +} +\value{ +A vector of length-composition data. The order of the vector is the order +the data frame was in before this function was called because it is just +extracting a column. } \description{ -Get the length-composition data to be used in the model +Get the length-composition data from a FIMSFrame object }