I have a data frame with 8 columns and 40 rows. All columns have numeric values. I need to change column 1 to 5 to character. I tried dplyr::mutate_at()
but I cannot get it to work. I don't want to create new columns, but change the class of the existing ones. I keep getting the error
Column col1
must be length 40 (the number of rows) or one, not 0
What is the right way to do this with dplyr? I guess I could just do
df$col1 <- as.character(df$col1)
for each of the columns, but I would like to learn the power of dplyr.
Any help is always appreciated. Thanks!!