Some sample code to get started here
ST <- c("AL","AL","AK","AK")
X1 <- c("2,21", "2,29", "3,49", "2.3")
X2 <- c("10,333","10,333", "11,333", "11,333")
df <- cbind(ST, X1, X2)
I am trying to write a loop, either with a for loop or with lapply that can parse out the numbers but skip the first row with state names. So far I am stuck with:
for(i in seq_along(df[,-1])) {
df[[i]] <- parse_number(df[[i]])
}
This is producing NA's in the ST column. I'm sure there is a simple fix to this, but it escapes me. Thank you!