What about trying the readr function readr::parse_number()? You'd have to first run the as.character() function to turn it from a factor to a character, and then parse_number to turn it into a number
suppressPackageStartupMessages(library(tidyverse))
df1 <- data.frame(col1 = c(1, 1, 1, 1, 1),
col2 = c("0:00", "1:15", "2:15", "3:30", "4:00"),
col3 = c("100%", "100%", "100%", "100%", "100%")
)
str(df1)
#> 'data.frame': 5 obs. of 3 variables:
#> $ col1: num 1 1 1 1 1
#> $ col2: Factor w/ 5 levels "0:00","1:15",..: 1 2 3 4 5
#> $ col3: Factor w/ 1 level "100%": 1 1 1 1 1
df1 <- df1 %>%
mutate(col3 = readr::parse_number(as.character(col3)))
str(df1)
#> 'data.frame': 5 obs. of 3 variables:
#> $ col1: num 1 1 1 1 1
#> $ col2: Factor w/ 5 levels "0:00","1:15",..: 1 2 3 4 5
#> $ col3: num 100 100 100 100 100
Created on 2019-08-18 by the reprex package (v0.3.0)
A side-benefit of importing it with the readr function read_csv() in the first place (as opposed to the base read.csv()) is that it will automatically start with it as a character...although you could just add an argument to your read.csv() function of stringsAsFactors=FALSE 