test = c ( "AAABBB", "CCC" )
This works : gsub ( "[A-Z]", "2", test ) None of these do : gsub ( "[A-Z]", [:alnum:], test ) gsub ( "[A-Z]", [[:alnum:]], test ) gsub ( "[A-Z]", "[:alnum:]", test ) gsub ( "[A-Z]", "[[:alnum:]]", test ) gsub ( "[A-Z]", "^[:alnum:]$", test ) What am I doing wrong, please ? -- View this message in context: http://www.nabble.com/Use-of--%3Aalnum%3A--or-.-in-gsub%28%29-etc..-tp21502786p21502786.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.