sanitizePercent: Sanitize percentage

Description Usage Arguments Value Intended usage Note Examples

Description

Take a character vector of percentages (e.g. "50%") and convert it to a numeric vector (e.g. 0.5).

Usage

1
2
3
4
5
6
7
sanitizePercent(object, ...)

## S4 method for signature 'atomic'
sanitizePercent(object)

## S4 method for signature 'character'
sanitizePercent(object)

Arguments

object

Object.

...

Additional arguments.

Value

Modified object. All percentage strings containing "%" (e.g. "50%") are converted to numeric proportions (e.g. 0.5).

Intended usage

This function is designed primarily to sanitize data imported from Microsoft Excel.

Note

Updated 2019-10-12.

Examples

1
2
3
4
5
6
object <- c("100%", "10.0%", "1%", "0.1%", "0.01%")
class(object)
print(object)
x <- sanitizePercent(object)
class(x)
print(x)

acidgenomics/pipette documentation built on Sept. 27, 2021, 9:10 a.m.