Skip to content

Commit

Permalink
Merge pull request #26 from philsf/release-0.4.0
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
philsf authored Feb 5, 2018
2 parents a1b8ad0 + 53cfef9 commit ff489a7
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: philsfmisc
Type: Package
Title: philsf's miscellaneous R functions
Version: 0.1.0
Version: 0.4.0
Authors@R: person("Felipe", "Figueiredo", email = "[email protected]", role = c("aut", "cre"))
Description: Miscellaneous R functions for convenient data analyses.
License: GPL2
Expand Down
4 changes: 4 additions & 0 deletions R/cv2logsd.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cv2logsd <- function(CV) {
SD <- sqrt( cv2logvar(CV) )
SD
}
4 changes: 4 additions & 0 deletions R/cv2logvar.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cv2logvar <- function( CV ) {
VAR <- (log((CV/100)^2 + 1))/(log(10)^2)
VAR
}
2 changes: 1 addition & 1 deletion R/logsd2cv.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
logsd2cv <- function(logsd, digits = 2, na.rm = TRUE) {
round(sqrt(exp(logsd^2) - 1)*100 , digits)
round(sqrt(exp((log(10)^2)*logsd^2) - 1)*100 , digits)
}
3 changes: 3 additions & 0 deletions R/logvar2cv.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
logvar2cv <- function(var, digits = 2, na.rm = TRUE) {
round(sqrt(exp((log(10)^2)*var) - 1)*100 , digits)
}
51 changes: 51 additions & 0 deletions man/cv2logsd.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
\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. ~~
}
\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 ~~
}
\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{
cv2logsd(50)
# [1] 0.2051523
}
% 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
51 changes: 51 additions & 0 deletions man/cv2logvar.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
\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. ~~
}
\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 ~~
}
\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{
cv2logvar(50)
# [1] 0.04208748
}
% 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
2 changes: 1 addition & 1 deletion man/logsd2cv.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ logsd2cv(x)
\examples{
d <- c(10,100,1000)
sd(log10(d)) # 1
logsd2cv(1) # 131.08\%
logsd2cv(1) # 1413.21\%
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
Expand Down
52 changes: 52 additions & 0 deletions man/logvar2cv.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
\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. ~~
}
\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 ~~
}
\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)
var(log10(d)) # 1
logvar2cv(1) # 1413.21\%
}
% 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

0 comments on commit ff489a7

Please sign in to comment.