Hi there,
I'm pretty sure that it's written down somewhere but I cannot find it so
far.
The little example shows different approaches to replace a substring.
Only the last one works. I think it has something to do with the fact
that "substr" is used on the left side. Can anybody refer to an
explanation for this behaviour?
Thanks a lot in advance!
Antje
values <- factor(c(rep("abc",3), rep("bcd",3), rep("cde",3)))
substr(values,2,3) <- ".."
substr(as.character(values),2,3) <- ".."
values <- as.character(values)
substr(values,2,3) <- ".."
______________________________________________
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.