diff --git a/DESCRIPTION b/DESCRIPTION index 243a0ab..9af2d67 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: philsfmisc Type: Package Title: philsf's miscellaneous R functions -Version: 0.6.1 +Version: 0.6.2 Authors@R: person("Felipe", "Figueiredo", email = "philsf79@gmail.com", role = c("aut", "cre")) Description: Miscellaneous R functions for convenient data analyses. License: file LICENSE @@ -9,3 +9,4 @@ Encoding: UTF-8 LazyData: true URL: https://github.com/philsf/philsfmisc Depends: R (>= 3.3.0) +RoxygenNote: 6.1.0 diff --git a/NAMESPACE b/NAMESPACE index ecbb4dd..4e6a6c4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,16 @@ -importFrom("stats", "qt", "sd") -exportPattern("^[[:alpha:]]+") +# Generated by roxygen2: do not edit by hand + +export(cv2logsd) +export(cv2logvar) +export(format.float) +export(format.interval) +export(format.pct) +export(geocv) +export(geomean) +export(geosd) +export(is.within) +export(logsd2cv) +export(logvar2cv) +export(predint) +importFrom(stats,qt) +importFrom(stats,sd) diff --git a/NEWS.md b/NEWS.md index 43aa006..c34adb7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# philsfmisc 0.6.2 + +- Now uses `roxygen2` for function documentation creation ( #37 ) +- Styles updated for all templates ( #45 ) + # philsfmisc 0.6.1 - Styles updated #41 diff --git a/R/cv2logsd.R b/R/cv2logsd.R index ec9d318..113d04a 100644 --- a/R/cv2logsd.R +++ b/R/cv2logsd.R @@ -1,3 +1,18 @@ +#' Convert the CV from a log-normal variable to the log-transformed standard deviation. +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' +#' @return Returns log-transformed sd +#' +#' @examples +#' cv2logsd(50) +#' # [1] 0.2051523 +#' +#' @author Felipe Figueiredo +#' @export + cv2logsd <- function(x) { SD <- sqrt( cv2logvar(x) ) SD diff --git a/R/cv2logvar.R b/R/cv2logvar.R index f61aae5..dcd1b51 100644 --- a/R/cv2logvar.R +++ b/R/cv2logvar.R @@ -1,3 +1,18 @@ +#' Convert the CV from a log-normal variable to the log-transformed variance. +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' +#' @return Returns the log-transformed variance. +#' +#' @examples +#' cv2logvar(50) +#' # [1] 0.04208748 +#' +#' @author Felipe Figueiredo +#' @export + cv2logvar <- function( x ) { VAR <- (log((x/100)^2 + 1))/(log(10)^2) VAR diff --git a/R/format.float.R b/R/format.float.R index c423fa3..ca18625 100644 --- a/R/format.float.R +++ b/R/format.float.R @@ -1,3 +1,31 @@ +#' Format numbers for printing +#' +#' @description Format numbers, given a `digits` argument as significant decimal places. +#' Numbers are always assumed to be \code{\link[base]{double}}. +#' +#' @param x Value to be formatted. +#' Input can be a numeric or character value. +#' +#' @param digits Number of fixed digits, after decimal point +#' +#' @return Returns a character value. +#' +#' @examples +#' format.float(0.5) +#' format.float(0.672, 4) +#' format.float(1.4927, 1) +#' format.float(c(1.756, 1.823)) +#' # Input is character +#' format.float("1.12543") +#' format.float(c("1.756", "1.823")) +#' +#' # Useful for data frames +#' DF <- data.frame(num = c(1.756, 1.823), char = c("1.756", "1.823"), stringsAsFactors = FALSE) +#' transform(DF, num = format.float(num), char = format.float(char)) +#' +#' @author Felipe Figueiredo +#' @export format.float + format.float <- function(x, digits = 2) { x <- suppressWarnings(as.numeric(x)) x <- formatC(x, format = "f", digits = digits) diff --git a/R/format.interval.R b/R/format.interval.R index ad73c78..17d7408 100644 --- a/R/format.interval.R +++ b/R/format.interval.R @@ -1,3 +1,24 @@ +#' Format intervals for printing +#' +#' @description Format intervals, given a `digits` argument as significant decimal places. +#' +#' @param interval Must be a vector of two values. +#' Values can be either numeric or character. +#' +#' @param digits Number of fixed digits, after decimal point. +#' +#' @return Returns a character value. +#' +#' @examples +#' format.interval(c(1.756, 1.823)) +#' # format.interval(1.5, 1) # error: 1.5 is not an interval +#' +#' # Input is character +#' format.interval(c("1.756", "1.823")) +#' +#' @author Felipe Figueiredo +#' @export format.interval + format.interval <- function(interval, digits = 2) { if (is.null(interval)) return(NULL) # if no argument passed, return if (anyNA(interval)) return(NA) # return NA in case of incomplete interval diff --git a/R/format.pct.R b/R/format.pct.R index c77e284..88cdd82 100644 --- a/R/format.pct.R +++ b/R/format.pct.R @@ -1,3 +1,25 @@ +#' Convenience function to format proportions as percentages +#' +#' @description +#' +#' @param p a numeric vector assumed to be a proportion. +#' @param digits the number of decimal digits to be used in the output. +#' @param pct.symbol (logical) whether or not to include the percent sign in the output. +#' +#' @return A character value formatted as percentages +#' +#' @examples +#' format.pct(.1) +#' format.pct(c(.42, .99), 0) +#' +#' m <- 10*matrix(c(1, 1.1, .9, 2), nrow = 2) +#' format.pct(fisher.test(m)$p.value) +#' format.pct(fisher.test(5*m)$p.value) +#' format.pct(fisher.test(m)$conf.int) +#' +#' @author Felipe Figueiredo +#' @export format.pct + format.pct <- function(p, digits = 1, pct.symbol = FALSE) { symbol <- "%" if (!pct.symbol) symbol <- NULL diff --git a/R/geocv.R b/R/geocv.R index a181148..06a8c78 100644 --- a/R/geocv.R +++ b/R/geocv.R @@ -1,3 +1,21 @@ +#' Compute the CV of log-normally distributed data. +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' @param na.rm (logical) whether or not to remove \code{NA} values from computation +#' +#' @return Returns the geometric CV (as percentage) +#' +#' @examples +#' d <- c(10,100,1000) +#' geocv(d) +#' geocv(d) == logsd2cv(1) +#' +#' @author Felipe Figueiredo +#' @export +#' @importFrom stats sd + geocv <- function(x, na.rm = TRUE) { logsd <- sd(log10(x), na.rm = na.rm) logsd2cv(logsd) diff --git a/R/geomean.R b/R/geomean.R index 15d4a4f..3236730 100644 --- a/R/geomean.R +++ b/R/geomean.R @@ -1,3 +1,21 @@ +#' Compute the geometric mean +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' +#' @details If any null values are present in \code{x} they are first replaced with \code{NA}. +#' +#' @return Returns the geometric mean of \code{x}. +#' +#' @examples +#' d <- c(10,100,1000) +#' geomean(d) +#' geomean(c(d,0)) # na.rm is TRUE by default for sd() +#' +#' @author Felipe Figueiredo +#' @export + geomean <- function(x) { x[(x == 0)] <- NA # discard null values 10^mean(log10(x), na.rm = T) diff --git a/R/geosd.R b/R/geosd.R index 6d2a657..d3f1ef4 100644 --- a/R/geosd.R +++ b/R/geosd.R @@ -1,3 +1,21 @@ +#' Compute the "geometric standard deviation" of data +#' +#' @description The "geometric standard deviation" is not as well-defined as the geometric mean. +#' This function returns the analogous concept of \code{sd} in the same manner of the geometric mean. +#' +#' @param x A numeric value, vector or list. +#' +#' @return The anti-log of the \code{sd} of log-transformed data `x`. +#' Base 10 is assumed as a fixed default in this version. +#' +#' @examples +#' d <- c(10,100,1000) +#' geosd(d) +#' +#' @author Felipe Figueiredo +#' @export +#' @importFrom stats sd + geosd <- function(x) { 10^sd(log10(x)) } diff --git a/R/is.within.R b/R/is.within.R index 3a4dd45..3265e96 100644 --- a/R/is.within.R +++ b/R/is.within.R @@ -1,3 +1,24 @@ +#' Check if number is within given interval +#' +#' @description +#' +#' @param value A numeric value, vector or list. +#' @param interval The (numeric) interval within which \code{value} is being tested. +#' @param open.interval logical: should \code{interval} be regarded as an open interval? +#' +#' @return The default method for \code{is.within} applied to an atomic vector returns +#' a logical vector of the same length as its argument x, containing TRUE for those elements contained within \code{interval}, and FALSE otherwise. +#' +#' @examples +#' is.within(1.5, c(0,5)) # TRUE +#' is.within(6, c(0,5)) # FALSE +#' +#' is.within(c(1.5, 6), c(0,5)) # vector: TRUE, TRUE +#' is.within(list(1.5, 6), c(0,5)) # list: TRUE, FALSE +#' +#' @author Felipe Figueiredo +#' @export is.within + is.within <- function(value, interval, open.interval = FALSE) { if (open.interval) return( value > interval[1] & value < interval[2] ) value >= interval[1] & value <= interval[2] diff --git a/R/logsd2cv.R b/R/logsd2cv.R index 7958a1f..0e83547 100644 --- a/R/logsd2cv.R +++ b/R/logsd2cv.R @@ -1,3 +1,19 @@ +#' Convert the log-transformed standard deviation from a log-normal variable to the CV. +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' +#' @return Returns the geometric CV (as percentage) +#' +#' @examples +#' d <- c(10,100,1000) +#' sd(log10(d)) # 1 +#' logsd2cv(1) # 1413.21\% +#' +#' @author Felipe Figueiredo +#' @export + logsd2cv <- function(x) { sqrt(exp((log(10)^2)*x^2) - 1)*100 } diff --git a/R/logvar2cv.R b/R/logvar2cv.R index 953e84e..45bb621 100644 --- a/R/logvar2cv.R +++ b/R/logvar2cv.R @@ -1,3 +1,19 @@ +#' Convert the log-transformed variance from a log-normal variable to the CV. +#' +#' @description +#' +#' @param x A numeric value, vector or list. +#' +#' @return Returns the geometric CV (as percentage) +#' +#' @examples +#' d <- c(10,100,1000) +#' var(log10(d)) # 1 +#' logvar2cv(1) # 1413.21\% +#' +#' @author Felipe Figueiredo +#' @export + logvar2cv <- function(x) { sqrt(exp((log(10)^2)*x) - 1)*100 } diff --git a/R/predint.R b/R/predint.R index 4179128..4d3321e 100644 --- a/R/predint.R +++ b/R/predint.R @@ -1,3 +1,23 @@ +#' Prediction Intervals for given data +#' +#' @description Compute a prediction interval of a vector, which is assumed +#' normally distributed with unknown mean and variance. +#' +#' @param datavector A numeric value, vector or list. +#' @param alpha the significance level required +#' +#' @return a vector of two values +#' A vector with values giving lower and upper prediction limits for each parameter. +#' +#' @examples +#' x <- rnorm(30) +#' predint(x) +#' +#' @author Felipe Figueiredo +#' @export +#' @importFrom stats sd +#' @importFrom stats qt + predint <- function(datavector, alpha = 0.05) { datavector <- datavector[!is.na(datavector)] # discard NA values N <- length(datavector) diff --git a/inst/rmarkdown/templates/Relatorio/skeleton/misc/style.docx b/inst/rmarkdown/templates/Relatorio/skeleton/misc/style.docx index 16b8d33..63c5778 100755 Binary files a/inst/rmarkdown/templates/Relatorio/skeleton/misc/style.docx and b/inst/rmarkdown/templates/Relatorio/skeleton/misc/style.docx differ diff --git a/inst/rmarkdown/templates/Relatorio/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/Relatorio/skeleton/skeleton.Rmd index 1820029..0b4686b 100644 --- a/inst/rmarkdown/templates/Relatorio/skeleton/skeleton.Rmd +++ b/inst/rmarkdown/templates/Relatorio/skeleton/skeleton.Rmd @@ -7,6 +7,7 @@ output: fig_caption: yes fig_height: 6 fig_width: 6 + keep_md: yes number_sections: yes toc: yes pdf_document: @@ -18,7 +19,7 @@ output: fig_width: 6 reference_docx: misc/style.docx toc: yes -subtitle: 'CÓDIGO: analise_dados_XX_aaaa' +subtitle: 'RELATÓRIO: analise_dados_XX_aaaa' toc-title: "Sumário" --- @@ -29,8 +30,6 @@ options(scipen = 999) library(pander) library(knitr) library(philsfmisc) - - ``` --- diff --git a/man/cv2logsd.Rd b/man/cv2logsd.Rd index 6e5885f..0e4d75c 100644 --- a/man/cv2logsd.Rd +++ b/man/cv2logsd.Rd @@ -1,51 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cv2logsd.R \name{cv2logsd} \alias{cv2logsd} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Convert the CV from a log-normal variable to the log-transformed standard deviation. -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Convert the CV from a log-normal variable to the log-transformed standard deviation.} \usage{ cv2logsd(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ +Returns log-transformed sd } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ cv2logsd(50) # [1] 0.2051523 + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/cv2logvar.Rd b/man/cv2logvar.Rd index 77eea19..1c59608 100644 --- a/man/cv2logvar.Rd +++ b/man/cv2logvar.Rd @@ -1,51 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cv2logvar.R \name{cv2logvar} \alias{cv2logvar} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Convert the CV from a log-normal variable to the log-transformed variance. -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Convert the CV from a log-normal variable to the log-transformed variance.} \usage{ cv2logvar(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ +Returns the log-transformed variance. } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ cv2logvar(50) # [1] 0.04208748 + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/format.float.Rd b/man/format.float.Rd index c5bf37b..feaf662 100644 --- a/man/format.float.Rd +++ b/man/format.float.Rd @@ -1,62 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/format.float.R \name{format.float} \alias{format.float} -\alias{format.double} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ -Format numbers for printing -} -\description{ -Format numbers, given a `digits` argument as significant decimal places. - -{Numbers are always assumed to be \code{\link[base]{double}}.} -} +\title{Format numbers for printing} \usage{ -format.float(x, digits) +\method{format}{float}(x, digits = 2) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ - Value to be formatted. - Input can be a numeric or character value. - } - \item{digits}{ - Number of fixed digits, after decimal point (default = 2) - } -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{Value to be formatted. +Input can be a numeric or character value.} + +\item{digits}{Number of fixed digits, after decimal point} } \value{ Returns a character value. -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -Felipe Figueiredo } -\note{ -%% ~~further notes~~ -\code{format.float} does NOT work with \code{factor} values. -} - -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -\code{\link[base]{numeric}} -%% ~~objects to See Also as \code{\link{help}}, ~~~ +\description{ +Format numbers, given a `digits` argument as significant decimal places. + Numbers are always assumed to be \code{\link[base]{double}}. } \examples{ format.float(0.5) format.float(0.672, 4) format.float(1.4927, 1) format.float(c(1.756, 1.823)) - # Input is character format.float("1.12543") format.float(c("1.756", "1.823")) @@ -64,8 +31,8 @@ format.float(c("1.756", "1.823")) # Useful for data frames DF <- data.frame(num = c(1.756, 1.823), char = c("1.756", "1.823"), stringsAsFactors = FALSE) transform(DF, num = format.float(num), char = format.float(char)) + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/format.interval.Rd b/man/format.interval.Rd index 8ab960f..3452841 100644 --- a/man/format.interval.Rd +++ b/man/format.interval.Rd @@ -1,65 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/format.interval.R \name{format.interval} \alias{format.interval} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ -Format intervals for printing -} -\description{ -Format intervals, given a `digits` argument as significant decimal places. -} +\title{Format intervals for printing} \usage{ -format.interval(interval, digits = 2) +\method{format}{interval}(interval, digits = 2) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{interval}{ -%% ~~Describe \code{interval} here~~ - Must be a vector of two values. +\item{interval}{Must be a vector of two values. +Values can be either numeric or character.} - Values can be either numeric or character. -} - \item{digits}{ - Number of fixed digits, after decimal point. (default = 2) -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ - -This uses \code{\link{format.float}} for formatting each of the limits of the interval. +\item{digits}{Number of fixed digits, after decimal point.} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... Returns a character value. } -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -Felipe Figueiredo -} -\note{ -%% ~~further notes~~ -} - -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ +\description{ +Format intervals, given a `digits` argument as significant decimal places. } \examples{ format.interval(c(1.756, 1.823)) - # format.interval(1.5, 1) # error: 1.5 is not an interval # Input is character format.interval(c("1.756", "1.823")) } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line +\author{ +Felipe Figueiredo +} diff --git a/man/format.pct.Rd b/man/format.pct.Rd index c85f229..0e656f9 100644 --- a/man/format.pct.Rd +++ b/man/format.pct.Rd @@ -1,40 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/format.pct.R \name{format.pct} \alias{format.pct} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ -Convenience function to format proportions as percentages -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Convenience function to format proportions as percentages} \usage{ -format.pct(p, digits = 1, pct.symbol = TRUE) +\method{format}{pct}(p, digits = 1, pct.symbol = FALSE) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{p}{a numeric vector assumed to be a proportion.} - \item{digits}{the number of decimal digits to be used in the output.} - \item{pct.symbol}{(logical) whether or not to include the percent sign in the output.} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{p}{a numeric vector assumed to be a proportion.} + +\item{digits}{the number of decimal digits to be used in the output.} + +\item{pct.symbol}{(logical) whether or not to include the percent sign in the output.} } \value{ -A character value formatted as percentages} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ +A character value formatted as percentages } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ format.pct(.1) @@ -44,8 +27,8 @@ m <- 10*matrix(c(1, 1.1, .9, 2), nrow = 2) format.pct(fisher.test(m)$p.value) format.pct(fisher.test(5*m)$p.value) format.pct(fisher.test(m)$conf.int) + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/geocv.Rd b/man/geocv.Rd index 5f81f4f..634c279 100644 --- a/man/geocv.Rd +++ b/man/geocv.Rd @@ -1,55 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geocv.R \name{geocv} \alias{geocv} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Compute the CV of log-normally distributed data. -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Compute the CV of log-normally distributed data.} \usage{ geocv(x, na.rm = TRUE) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} - \item{na.rm}{ -%% ~~Describe \code{na.rm} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} + +\item{na.rm}{(logical) whether or not to remove \code{NA} values from computation} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ +Returns the geometric CV (as percentage) } -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ -} - -%% ~Make other sections like Warning with \section{Warning }{....} ~ +\description{ -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ d <- c(10,100,1000) geocv(d) geocv(d) == logsd2cv(1) + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/geomean.Rd b/man/geomean.Rd index 219c699..2152f18 100644 --- a/man/geomean.Rd +++ b/man/geomean.Rd @@ -1,46 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geomean.R \name{geomean} \alias{geomean} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Compute geometric mean -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Compute the geometric mean} \usage{ geomean(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{vector of numeric. -%% ~~Describe \code{x} here~~ -} -} -\details{ -If any null values are present in \code{x} they are first replaced with \code{NA}. +\item{x}{A numeric value, vector or list.} } \value{ Returns the geometric mean of \code{x}. -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -Felipe Figueiredo -} -\note{ -%% ~~further notes~~ } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ +} +\details{ +If any null values are present in \code{x} they are first replaced with \code{NA}. } \examples{ d <- c(10,100,1000) @@ -48,7 +24,6 @@ geomean(d) geomean(c(d,0)) # na.rm is TRUE by default for sd() } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line +\author{ +Felipe Figueiredo +} diff --git a/man/geosd.Rd b/man/geosd.Rd index d543235..0e7c0e5 100644 --- a/man/geosd.Rd +++ b/man/geosd.Rd @@ -1,56 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geosd.R \name{geosd} \alias{geosd} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Compute the "geometric standard deviation" of data -%% ~~function to do ... ~~ -} -\description{ -The "geometric standard deviation" is not as well-defined as the geometric mean. -This function returns the analogous concept of \code{sd} in the same manner of the geometric mean. -} +\title{Compute the "geometric standard deviation" of data} \usage{ geosd(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} } \value{ The anti-log of the \code{sd} of log-transformed data `x`. -Base 10 is assumed as a fixed default in this version. - -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ + Base 10 is assumed as a fixed default in this version. } - -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ -\code{\link{geomean}} +\description{ +The "geometric standard deviation" is not as well-defined as the geometric mean. + This function returns the analogous concept of \code{sd} in the same manner of the geometric mean. } \examples{ d <- c(10,100,1000) geosd(d) + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/is.within.Rd b/man/is.within.Rd index ff6bd60..c6ee092 100644 --- a/man/is.within.Rd +++ b/man/is.within.Rd @@ -1,54 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/is.within.R \name{is.within} \alias{is.within} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{ -Check if number is within given interval -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Check if number is within given interval} \usage{ is.within(value, interval, open.interval = FALSE) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{value}{ -A numeric value, vector or list. -} - \item{interval}{ -%% ~~Describe \code{interval} here~~ -The (numeric) interval within which \code{value} is being tested. -} - \item{open.interval}{ -%% ~~Describe \code{open.interval} here~~ -logical: should \code{interval} be regarded as an open interval? -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{value}{A numeric value, vector or list.} + +\item{interval}{The (numeric) interval within which \code{value} is being tested.} + +\item{open.interval}{logical: should \code{interval} be regarded as an open interval?} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -The default method for \code{is.within} applied to an atomic vector returns a logical vector of the same length as its argument x, containing TRUE for those elements contained within \code{interval}, and FALSE otherwise. -} -\references{ -%% ~put references to the literature/web site here ~ +The default method for \code{is.within} applied to an atomic vector returns + a logical vector of the same length as its argument x, containing TRUE for those elements contained within \code{interval}, and FALSE otherwise. } -\author{ -Felipe Figueiredo -} -\note{ -%% ~~further notes~~ -} - -%% ~Make other sections like Warning with \section{Warning }{....} ~ +\description{ -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ is.within(1.5, c(0,5)) # TRUE @@ -56,8 +26,8 @@ is.within(6, c(0,5)) # FALSE is.within(c(1.5, 6), c(0,5)) # vector: TRUE, TRUE is.within(list(1.5, 6), c(0,5)) # list: TRUE, FALSE + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/logsd2cv.Rd b/man/logsd2cv.Rd index 96ef56b..60e5e81 100644 --- a/man/logsd2cv.Rd +++ b/man/logsd2cv.Rd @@ -1,52 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/logsd2cv.R \name{logsd2cv} \alias{logsd2cv} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Convert the log-transformed standard deviation from a log-normal variable to the CV. -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Convert the log-transformed standard deviation from a log-normal variable to the CV.} \usage{ logsd2cv(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ +Returns the geometric CV (as percentage) } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ d <- c(10,100,1000) sd(log10(d)) # 1 -logsd2cv(1) # 1413.21\% +logsd2cv(1) # 1413.21\\\% + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/logvar2cv.Rd b/man/logvar2cv.Rd index 9063a4e..2db9825 100644 --- a/man/logvar2cv.Rd +++ b/man/logvar2cv.Rd @@ -1,52 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/logvar2cv.R \name{logvar2cv} \alias{logvar2cv} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Convert the log-transformed variance from a log-normal variable to the CV. -%% ~~function to do ... ~~ -} -\description{ -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Convert the log-transformed variance from a log-normal variable to the CV.} \usage{ logvar2cv(x) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{ -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ +\item{x}{A numeric value, vector or list.} } \value{ -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{ -%% ~~who you are~~ -} -\note{ -%% ~~further notes~~ +Returns the geometric CV (as percentage) } +\description{ -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ } \examples{ d <- c(10,100,1000) var(log10(d)) # 1 -logvar2cv(1) # 1413.21\% +logvar2cv(1) # 1413.21\\\% + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/man/predint.Rd b/man/predint.Rd index 5da3a77..0ec851f 100644 --- a/man/predint.Rd +++ b/man/predint.Rd @@ -1,54 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/predint.R \name{predint} \alias{predint} -%- Also NEED an '\alias' for EACH other topic documented here. -\title{Prediction Intervals for given data -%% ~~function to do ... ~~ -} -\description{Compute a prediction interval of a vector, which is assumed normally distributed with unknown mean and variance. -%% ~~ A concise (1-5 lines) description of what the function does. ~~ -} +\title{Prediction Intervals for given data} \usage{ predint(datavector, alpha = 0.05) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{datavector}{a numeric vector or an R object which is coercible to one by as.double(x)} - \item{alpha}{the significance level required (default = 0.05) -%% ~~Describe \code{x} here~~ -} -} -\details{ -%% ~~ If necessary, more details than the description above ~~ -} -\value{a vector of two values -A vector with values giving lower and upper prediction limits for each parameter. -%% ~Describe the value returned -%% If it is a LIST, use -%% \item{comp1 }{Description of 'comp1'} -%% \item{comp2 }{Description of 'comp2'} -%% ... -} -\references{ -%% ~put references to the literature/web site here ~ -} -\author{Felipe Figueiredo -%% ~~who you are~~ +\item{datavector}{A numeric value, vector or list.} + +\item{alpha}{the significance level required} } -\note{ -%% ~~further notes~~ +\value{ +a vector of two values + A vector with values giving lower and upper prediction limits for each parameter. } - -%% ~Make other sections like Warning with \section{Warning }{....} ~ - -\seealso{ -%% ~~objects to See Also as \code{\link{help}}, ~~~ +\description{ +Compute a prediction interval of a vector, which is assumed + normally distributed with unknown mean and variance. } \examples{ x <- rnorm(30) predint(x) -predint(x, alpha = 0.01) + +} +\author{ +Felipe Figueiredo } -% Add one or more standard keywords, see file 'KEYWORDS' in the -% R documentation directory. -\keyword{ ~kwd1 }% use one of RShowDoc("KEYWORDS") -\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line diff --git a/philsfmisc.Rproj b/philsfmisc.Rproj index 497f8bf..f0d6187 100644 --- a/philsfmisc.Rproj +++ b/philsfmisc.Rproj @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace,vignette