I am working with a data frame in which I need to edit the entries in one particular column to allow for easy sorting. The data frame looks like this when imported:
Assay Genotype Description Sample Operator
1 CCT6-18 C A.Conservative 1_062911 Automatic
2 CCT6-24 C E.User Call 1_062911 charles
3 CCT6-25 A A.Conservative 1_062911 Automatic
I need to change the assay column from CCT6-18 to CCT6-018. This “assay” appears multiple times within the data frame and I’d like to change all of the entries at once. Ive tried the gsub function but it returns data in a format that I am unfamiliar with. I’d like to get the data back in a data frame.
Help!
Should see you right.
Also, try
str(df)orclass(df$Assay)to see what class your Assay column is. If it is a factor this could be the reason you’re getting tripped up. If so rundf$Assay <- as.character(df$Assay)first.