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"
Obvi
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
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
3 matches
Mail list logo