In a dataframe like this:
a <- c(rep ("C-B", 4), rep("C_C", 6))
b <- c(rep ("B-B", 4), rep("B_C", 6))
c <- c(rep ("A-B", 4), rep("A_C", 6))
data1 <- data.frame (a, b, c)
I would like to replace in the whole dataframe the "_" with "-"
I tried this but it does not work properly:
data2 <- gsub('_', '-', data1)
What should I change?