knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "inst/extdata/README-"
)

Powers

This folder contains an R package called "powers". The functions in this package are a convenient way of taking numbers to various powers, and plotting the result. The functions are also capable of taking strings to arbitrary "powers" which just means to repeat them in this context. The functions themselves can be found in the "R" folder. See the inst/doc folder for a useful vignette that explains some example usage for this package. Below is a list of all external functions:

The package also contains two variables: tenvec and negtenvec. These are vectors of numbers from 1 to 10 or -1 to -10, useful for testing.

Installation

You can install powers from github with:

install_github("HScheiber/powers")

Examples

This is a basic example which shows you how to solve a common problem, squaring a number:

powers::square(1:10)

We can plot a function using the input switches:

plot_object <- powers::square(1:20, plot_it = TRUE, returnVal = FALSE, returnPlot = TRUE)

It is even possible to use these functions on character data:

powers::cube(letters)

The reciprocal function takes the -1 power of numerics, and reverses the direction of characters:

powers::reciprocal(1:20, plot_it = TRUE)

powers::reciprocal("Hello world")

If the user feels the need to take any arbitrary power and plot the result, that is also possible in this package using the a input of the pwr function:

powers::pwr(1:20, a = 5, plot_it = TRUE)

powers::pwr("Hello world", a = -2)

For developers

The pow.R function is an internal function that all external functions in this package depend on. It takes an input number or vector to an arbitrary power. Please build any new functions for this package by utilizing the pow.R function.



HScheiber/powers documentation built on May 22, 2019, 1 p.m.