knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
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.
Box_Cox( ): This function performs the box cox transform of inputs.
log( ): This function performs log transformation of inputs.
cube( ): This function takes inputs to the power of 3.
square( ): This function takes inputs to the power of 2.
You can install powers from github with:
# install.packages("devtools") devtools::install_github("QinxinLin/powers")
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)
Use the internal pow function as the machinery for the front-end functions such as Box_Cox, log, square and cube.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.