cube: Cube a vector

Description Usage Arguments Details Value See Also Examples

Description

This function accepts inputs of numerical, logical, or character data. It then finds the cube of the input. There is also an option to plot the resulting output.

Usage

1
cube(x, plot_it = FALSE, returnVal = TRUE, returnPlot = FALSE)

Arguments

x

The vector to be cubed.

plot_it

A logical switch. If TRUE then a quick plot of the power function is created.

returnVal

A logical switch. If TRUE then the a vector of cubed inputs is returned. TRUE by default, but useful if you only wish to plot the input.

returnPlot

A logical switch. If TRUE then the function plot is returned as part of the output object.

Details

The function output depends on what inputs are used. In the case of numeric or logical data, the output will simply be the cube of the input.

In the case of characters, the output will be the input character but with each component of the vector repeated thrice. For character inputs, the plot_it switch does not have any effect.

By selecting returnPlot = TRUE then the output will contain a plot object. In the case of character vectors, no plot is generated and the plot object is empty.

Value

A vector that is the cube of x, this output can be supressed with returnVal. Option to also return a plot object with returnPlot.

See Also

pwr, square, reciprocal, tenvec, negtenvec

Examples

1
2
3
4
5
plot_object <- cube(1:20, plot_it = TRUE, returnVal = FALSE, returnPlot = TRUE)
cube(-2)
cube(TRUE)
cube(letters)
cube("hello world")

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