This function is a wrapper around a very common data transformation that is
done every time we make a frequency plot. It changes the x
variable by
multiplying it 100 and creates a new variable called pct_lab
which is a
string of the x
variable but with a "%" symbol added.
Value
The original data.frame found in data
with two changes. The column
called "pct" is multiplied by 100 and a new column is created called "pct_lab"
that is the same as pct but with a "%" symbol at the end of it.
Examples
library(dplyr)
# get the frequencies of top andupdate
test_data %>%
get_freqs(top) %>%
pct_conv()
#> # A tibble: 4 × 4
#> top n pct pct_lab
#> <dbl+lbl> <int> <dbl> <chr>
#> 1 1 [Strongly agree] 25 10 10%
#> 2 2 [Somewhat agree] 85 34 34%
#> 3 3 [Somewhat disagree] 75 30 30%
#> 4 4 [Strongly disagree] 65 26 26%