Skip to content

Commit

Permalink
Merge branch '28-build-warnings' into release-0.6.0. Close #28
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Figueiredo committed Jul 1, 2018
2 parents c6a40ed + 89f70e4 commit f5985e6
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 28 deletions.
4 changes: 2 additions & 2 deletions R/cv2logsd.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cv2logsd <- function(CV) {
SD <- sqrt( cv2logvar(CV) )
cv2logsd <- function(x) {
SD <- sqrt( cv2logvar(x) )
SD
}
4 changes: 2 additions & 2 deletions R/cv2logvar.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cv2logvar <- function( CV ) {
VAR <- (log((CV/100)^2 + 1))/(log(10)^2)
cv2logvar <- function( x ) {
VAR <- (log((x/100)^2 + 1))/(log(10)^2)
VAR
}
8 changes: 4 additions & 4 deletions R/format.float.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
format.float <- function(value, digits = 2) {
value <- suppressWarnings(as.numeric(value))
value <- formatC(value, format = "f", digits = digits)
value
format.float <- function(x, digits = 2) {
x <- suppressWarnings(as.numeric(x))
x <- formatC(x, format = "f", digits = digits)
x
}
6 changes: 3 additions & 3 deletions R/geocv.R
Original file line number Diff line number Diff line change
@@ -1,4 +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)
geocv <- function(x, na.rm = TRUE) {
logsd <- sd(log10(x), na.rm = na.rm)
logsd2cv(logsd)
}
6 changes: 3 additions & 3 deletions R/geomean.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
geomean <- function(datavector) {
datavector[(datavector == 0)] <- NA # discard null values
10^mean(log10(datavector), na.rm = T)
geomean <- function(x) {
x[(x == 0)] <- NA # discard null values
10^mean(log10(x), na.rm = T)
}
4 changes: 2 additions & 2 deletions R/geosd.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
geosd <- function(datavector) {
10^sd(log10(datavector))
geosd <- function(x) {
10^sd(log10(x))
}
4 changes: 2 additions & 2 deletions 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((log(10)^2)*logsd^2) - 1)*100 , digits)
logsd2cv <- function(x) {
sqrt(exp((log(10)^2)*x^2) - 1)*100
}
4 changes: 2 additions & 2 deletions R/logvar2cv.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
logvar2cv <- function(var, digits = 2, na.rm = TRUE) {
round(sqrt(exp((log(10)^2)*var) - 1)*100 , digits)
logvar2cv <- function(x) {
sqrt(exp((log(10)^2)*x) - 1)*100
}
6 changes: 3 additions & 3 deletions man/format.float.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Format numbers, given a `digits` argument as significant decimal places.
{Numbers are always assumed to be \code{\link[base]{double}}.}
}
\usage{
format.float(x)
format.float(x, digits)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
\item{value}{
\item{x}{
Value to be formatted.
Input can be a numeric or character value.
}
Expand Down Expand Up @@ -62,7 +62,7 @@ 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 = F)
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))
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
Expand Down
2 changes: 1 addition & 1 deletion man/format.interval.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Felipe Figueiredo
\examples{
format.interval(c(1.756, 1.823))

format.interval(1.5, 1) # error: 1.5 is not an interval
# format.interval(1.5, 1) # error: 1.5 is not an interval

# Input is character
format.interval(c("1.756", "1.823"))
Expand Down
5 changes: 1 addition & 4 deletions man/geocv.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
%% ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
geocv(x, digits = 2, na.rm = TRUE)
geocv(x, 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~~
Expand Down

0 comments on commit f5985e6

Please sign in to comment.