# NOT RUN {
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"))
# }
Run the code above in your browser using DataLab