I have a df like this:
I want to clean it up by two method:
gsubthe subject 1-4 if it started with\or/to""; or- change all
/to\, and add\to the one that is not start with\.
Is it a way to do this using mutate(across(everything(),...) or any other way?
I would like to know how to achieve both methods if it is possible. Thanks.
The ideal output will looks like this:
sample data:
df<- structure(list(ID = c("Tom", "Jerry"), Subject1 = c("/Art", "/ELA"
), Subject2 = c("\\Math", "/Math"), Subject3 = c("PE", "\\Bio\\2"
), Subject4 = c(NA, "\\Music\\1")), row.names = c(NA, -2L), class = c("tbl_df",
"tbl", "data.frame"))

