I'm trying to build out a function where I can specify column positions and class type.
Using the iris dataset it would look like this:
magic_class_write <- function(df, col_nos, class_types ){
fill in the blanks
}
library(tidyverse)
# This is how I do it now
glimpse(iris)
class(iris$Sepal.Length) <- "comma"
class(iris$Petal.Width) <- "comma"
map(iris, class)
# This is how it will be done with the function
magic_class_write(df = iris, col_nos = c(1, 3), class_types = c("comma", "comma"))
Any ideas?