I have data like
obs-----Var1
1-----36.091
2-----14.678
3------3.12
My problem is that i want to replace "." by a "," with gsub(), but not for all the observations, just for the observations that have 3 characters to the right of the dot ("."). In this case for observations 1 and 2.
I'm thinking of something like:
if ( nchar(something indicating the characters to the right of ".") >= 3){
gsub(".",",",data[,1])
} else {}
I don't know if it's the correct approach, but i don't figure out another way.
Thanks
Aucun commentaire:
Enregistrer un commentaire