Change all columns from factor to numeric in R
I am working with a big dataset that is causing some trouble because some of the columns I the dataset are being treated as factors. How can I convert all of the columns from factor to numeric, without having to do that column by column?? I have tried to apply a small loop, but it returns NA values. Here's a sample data that applies to the case: data <- structure(list(v1 = c(22.394, 43.72, 58.544, 56.877, 1.659, 29.142, 67.836, 68.851), v2 = c(144.373, 72.3, 119.418, 112.429, 35.779, 41.661, 166.941, 126.548), v3 = structure(c(33L, 29L, 33L, 5L, 13L, 31L, 5L, 8L), .Label = c("", "#VALUE!", "0"