knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

powers

The goal of powers is to perform basic computations on numeric vectors. This package has four exported functions: Box_Cox(), log(), cube() and square(). There is one internal function pow(). These functions only work for numeric inputs.

Installation

You can install powers from github with:

# install.packages("devtools")
devtools::install_github("QinxinLin/powers")

Example

Firstly, I need to load powers package.

library(powers)

(1) Examples of Box_Cox() function

#inputs without NA
num<-c(-1,4,3,-3,-5)
Box_Cox(num,3,6)
#inputs with NA
num<-c(-1,4,3,-3,-5,NA)
Box_Cox(num,2,7,na.omit = TRUE)
Box_Cox(num,2,7,na.omit = FALSE)

(2) Examples of log() function

#inputs without NA
num<-c(4,3,8,5)
log(num,2)
#inputs with NA
num<-c(4,3,8,5,NA)
log(num,2,na.omit = TRUE)
log(num,2,na.omit = FALSE)

(3) Examples of square() function

#numeric inputs
num<-c(4,3,8,5)
square(num)
#non-numeric inputs
num<-c(4,3,8,5,"a")
square(num)

(4) Examples of cube() function

num<-c(4,3,8,5)
cube(num)
#non-numeric inputs
num<-c(4,3,8,5,"a")
cube(num)

For Developers

Use the internal pow function as the machinery for the front-end functions such as Box_Cox, log, square and cube.



QinxinLin/powers documentation built on May 24, 2019, 7:53 a.m.