I would like to convert variable v1 from character to numeric. The values in v1 are numbers.
I tried:
v1 <- as.numeric(v1)
This changes the variable to numeric but changes all values with >3 digits to NA.
> dput(dat)
structure(list(X = c("Baldwin.County", "Banks.County", "Barrow.County",
"Bibb.County", "Butts.County", "Clarke.County", "Columbia.County",
"Dawson.County", "DeKalb.County", "Elbert.County", "Forsyth.County",
"Franklin.County", "Glascock.County", "Greene.County",
"Gwinnett.County",
"Habersham.County", "Hall.County", "Hancock.County", "Hart.County",
"Henry.County", "Jackson.County", "Jasper.County", "Jefferson.County",
"Jones.County", "Lamar.County", "Lincoln.County", "Lumpkin.County",
"McDuffie.County", "Madison.County", "Monroe.County", "Morgan.County",
"Newton.County", "Oconee.County", "Oglethorpe.County", "Putnam.County",
"Rabun.County", "Richmond.County", "Rockdale.County", "Spalding.County",
"Stephens.County", "Taliaferro.County", "Towns.County", "Union.County",
"Walton.County", "Warren.County", "Washington.County", "White.County",
"Wilkes.County", "Wilkinson.County"), total = c("11,936", "333",
"6,285", "50,801", "4,767", "21,606", "17,549", "117", "270,370",
"3,719", "5,508", "1,138", "185", "3,913", "159,130", "910",
"9,417", "4,687", "3,579", "65,739", "3,400", "2,037", "5,398",
"4,981", "3,210", "1,698", "366", "5,394", "1,757", "4,124",
"3,117", "30,641", "1,312", "1,799", "3,864", "252", "72,566",
"32,136", "14,073", "1,840", "742", "108", "155", "10,220", "2,221",
"7,293", "605", "2,801", "2,358"), malet = c("5,996", "166",
"2,957", "22,113", "2,889", "9,160", "8,268", "105", "118,932",
"1,688", "2,536", "511", " 54", "1,661", "71,095", "255", "4,410",
"2,605", "1,728", "28,442", "1,810", "960", "2,378", "2,358",
"1,426", "709", "178", "2,358", "916", "1,928", "1,325", "13,197",
"684", "820", "1,830", "209", "32,360", "13,739", "6,127", "852",
"358", " 41", "123", "4,545", "1,031", "3,528", "157", "1,255",
"1,089"), m1 = c("1,164", " 63", "476", "4,144", "1,050", "2,017",
"520", " 29", "13,043", "382", "130", "63", " 41", "365", "4,129",
" 35", "820", "1,134", "293", "2,430", "351", "215", "470", "180",
"156", "188", " 28", "630", "249", "606", "301", "1,681", "123",
"216", "206", " 49", "5,876", "1,012", "1,358", "53", " 97",
" 0", " 29", "954", "377", "896", " 48", "283", "94")), class =
"data.frame", row.names = c(NA, -49L))