Re: [R] explanation for left-side behaviour

2009-12-02 Thread Antje
Hi Don, thanks for your answer. Okay, I should have mentioned the error messages I get for case 1 and 2 - sorry. I was just surprised because the following does not give an error (though I feed with the factor vector): substr(values,2,3) [1] bc bc bc cd cd cd de de de Obviously, the factor

[R] explanation for left-side behaviour

2009-12-01 Thread Antje
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

Re: [R] explanation for left-side behaviour

2009-12-01 Thread Don MacQueen
Read the help page for substr(). It says that the first argument should be a character vector. The only one that works is the one where you gave it a character vector. You said only third one works. But you didn't explain what you mean by works. It's always a good idea on r-help to show both