If I have a data frame df in R:
area industry value
1 31-33 6
2 44-45 1023
3 48-49 8
How would I replace 31-33 with 31, 44-45 with 44, and 48-49 with 48? Every example on this site that I've tried hasn't worked. My latest try was
levels(df$industry)[levels(df$industry)=="31-33"] <- "31"
But like everything else I've tried, once I actually write the data to a txt file and import it into SQL it appears as a null.
Keep in mind that there are more columns and an enourmous amount of rows with more industry codes besides these three, but these three are the only ones that need to be changed. Thanks.