[R] explanation for left-side behaviour
    Antje 
    niederlein-rstat at yahoo.de
       
    Tue Dec  1 09:57:35 CET 2009
    
    
  
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) <- ".."
    
    
More information about the R-help
mailing list