Skip to contents

# Attach Per Cent Sign to Data

Source: `R/Percent.R`
`Percent.Rd`

This function is a wrapper for easy affixing of the per cent sign (%) to a value or a vector or a data frame of values.

## Usage

    Percent(Data, Type, format = "f", ...)

## Arguments

Data

  The Data which the percent sign is to be affixed. The data must be in the raw form because for frame argument, the per cent value of each cell is calculated before the sign is affixed.

Type

  The type of data. The default arguments are Value for single numeric data of Frame for a numeric vector or data frame data. In the case of vector or data frame, the per cent value of each cell is calculated before the per cent sign is affixed.

format

  The format of the output which is internal and the default is a character factor

...

  Additional arguments that may be passed to the function

## Value

This function returns the result as

`percent`

  values with the percentage sign (%) affixed.

## Examples

    Data <- c(1.2, 0.5, 0.103, 7, 0.1501)
    Percent(Data = Data, Type = "Frame")  # Value, Frame
    #> $percent
    #> [1] "13.4032%" "5.5847%"  "1.1504%"  "78.1852%" "1.6765%"
    #>
    #> $Rate
    #> [1] 13.4  5.6  1.2 78.2  1.7
    #>
    Data <- 1.2
    Percent(Data = Data, Type = "Value")  # Value, Frame
    #> $percent
    #> [1] "1.2%"
    #>
    #> $Rate
    #> [1] 100
    #>
    Percent(Data = sample, Type = "Frame")  # Value, Frame
    #> $percent
    #>      A   B   C   D   E   F   G   H
    #> 1  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 2  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 3  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 4  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 5  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 6  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 7  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 8  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 9  NA% NA% NA% NA% NA% NA% NA% NA%
    #> 10 NA% NA% NA% NA% NA% NA% NA% NA%
    #> 11 NA% NA% NA% NA% NA% NA% NA% NA%
    #> 12 NA% NA% NA% NA% NA% NA% NA% NA%
    #> 13 NA% NA% NA% NA% NA% NA% NA% NA%
    #>
    #> $Rate
    #>     A  B  C  D  E  F  G  H
    #> 1  NA NA NA NA NA NA NA NA
    #> 2  NA NA NA NA NA NA NA NA
    #> 3  NA NA NA NA NA NA NA NA
    #> 4  NA NA NA NA NA NA NA NA
    #> 5  NA NA NA NA NA NA NA NA
    #> 6  NA NA NA NA NA NA NA NA
    #> 7  NA NA NA NA NA NA NA NA
    #> 8  NA NA NA NA NA NA NA NA
    #> 9  NA NA NA NA NA NA NA NA
    #> 10 NA NA NA NA NA NA NA NA
    #> 11 NA NA NA NA NA NA NA NA
    #> 12 NA NA NA NA NA NA NA NA
    #> 13 NA NA NA NA NA NA NA NA
    #>