I have a dataframe with 51 observations and 43 variables, all of which are as characters. I want to coerce the columns 3:43 as numeric. How do I coerce these into numeric without touching the first two columns?
I attached an example dataframe that resembles mine, but it's NOT my true dataframe (I'm not the only owner of the data so I can't legally share it). Imagine the first two columns are actually characters, not doubles, and this will give you a good picture. I apologize for any inconvenience.
df <- structure(list(`Analyte Sample` = c(1, 2, 3, 4, 5, 6), A = c("4190", "6665", "7435", "2052", "783", "322"), B = c("11569", "6677",
"3852", "983.88", "589", "359"), C = c("20453", "7699", "2499", "707.98", "412", "328"), D = c("7893", NA, "1623", "685.64",
"321", "644"), E = c("320", "15444", "2049", "1065", "389", "365"), F = c("7438", NA, "3472", "1057", "563", "401"), G = c(7345,
9001, 2473, 1138, 516, 403), H = c("9004", "3998", "2299", "964.88", "499", "341"), I = c("8434", "8700", "2217", "1263", "567", "352"
), J = c("7734", "6733", "2092", "1115", "637", "332"), K = c(NA, NA, "2118", "862.13", "426", "355"), L = c(6345, 7688, 2311,
1195, 647, 366), M = c("4222", NA, "1846", "814.61", "422", "314"), N = c("6773", "8934", "2381", "1221", "677", "356"), O = c(NA,
NA, NA, "564.5", "226", "476")), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))