Description Usage Arguments Value Examples
Convert Multiple Columns of a data.frame
All at once conversion of a data.frame
from current column types to
alternates.
1 | convert_cols(d, cast)
|
d |
A |
cast |
A |
A data.frame
with converted column types.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | n = 100
st = sample(LETTERS, n, replace = TRUE)
sr = sample(letters, n, replace = TRUE)
num = rnorm(n)
d = data.frame(x = st, y = num, z = sr, stringsAsFactors = FALSE)
# Convert all columns
o = convert_cols(d,c("f", "c", "f"))
# Convert a subset
d[, c(1, 3)] = convert_cols(d[, c(1, 3)], c("f", "f"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.