I want to replace dots in "2014.06.09" to "2014-06-09". I am using gsub() function for it. If
x <- "2014.06.09"
gsub('2', '-' ,x)
# [1] "-014.06.09"
But when I try
gsub('.', '-', x)
# [1] "----------"
instead of "2014-06-09".
class(x)
# "character"
Can some suggest me a way to get this right and also why it is not working for '.' (dot)