-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from philsf/release-0.3.0
Release 0.3.0
- Loading branch information
Showing
9 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
geocv <- function(datavector, digits = 2, na.rm = TRUE) { | ||
logsd <- sd(log10(datavector), na.rm = na.rm) | ||
logsd2cv(logsd, digits = digits, na.rm = na.rm) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
geomean <- function(datavector) { | ||
datavector[(datavector == 0)] <- NA # discard null values | ||
10^mean(log10(datavector), na.rm = T) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
geosd <- function(datavector) { | ||
10^sd(log10(datavector)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
logsd2cv <- function(logsd, digits = 2, na.rm = TRUE) { | ||
round(sqrt(exp(logsd^2) - 1)*100 , digits) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
\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. ~~ | ||
} | ||
\usage{ | ||
geocv(x, digits = 2, na.rm = TRUE) | ||
} | ||
%- maybe also 'usage' for other objects documented here. | ||
\arguments{ | ||
\item{x}{ | ||
%% ~~Describe \code{x} here~~ | ||
} | ||
\item{digits}{ | ||
%% ~~Describe \code{digits} here~~ | ||
} | ||
\item{na.rm}{ | ||
%% ~~Describe \code{na.rm} here~~ | ||
} | ||
} | ||
\details{ | ||
%% ~~ If necessary, more details than the description above ~~ | ||
} | ||
\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~~ | ||
} | ||
|
||
%% ~Make other sections like Warning with \section{Warning }{....} ~ | ||
|
||
\seealso{ | ||
%% ~~objects to See Also as \code{\link{help}}, ~~~ | ||
} | ||
\examples{ | ||
d <- c(10,100,1000) | ||
geocv(d) | ||
geocv(d) == logsd2cv(1) | ||
} | ||
% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
\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. ~~ | ||
} | ||
\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}. | ||
} | ||
\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~~ | ||
} | ||
|
||
%% ~Make other sections like Warning with \section{Warning }{....} ~ | ||
|
||
\seealso{ | ||
%% ~~objects to See Also as \code{\link{help}}, ~~~ | ||
} | ||
\examples{ | ||
d <- c(10,100,1000) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
\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. | ||
} | ||
\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 ~~ | ||
} | ||
\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~~ | ||
} | ||
|
||
%% ~Make other sections like Warning with \section{Warning }{....} ~ | ||
|
||
\seealso{ | ||
%% ~~objects to See Also as \code{\link{help}}, ~~~ | ||
\code{\link{geomean}} | ||
} | ||
\examples{ | ||
d <- c(10,100,1000) | ||
geosd(d) | ||
} | ||
% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
\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. ~~ | ||
} | ||
\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 ~~ | ||
} | ||
\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~~ | ||
} | ||
|
||
%% ~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) # 131.08\% | ||
} | ||
% 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 |