Why does the gsub function in R doesn't work on '.' operator? -



Why does the gsub function in R doesn't work on '.' operator? -

i have array named myfile has dates in character format. eg - "2014.01.29" "2014.02.02" "2014.01.09" "2014.01.23" "2014.01.09" "2014.01.29"

now, want replace '.' operator '-'. want "2014.01.29" "2014-01-29". when utilize code

gsub('.' , '-' , myfile[1])

i output '----------'. command works absolutely normal when replace '.' in gsub else. help appreciated.

you need escape . can done either putting in [.] or \\..

gsub('[.]', '-', myfile[1])

or

gsub('\\.', '-', myfile[1])

r gsub

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -