[R] How to trim the front of a string?

2009-11-21 Thread rok90
Hey everybody! I have a problem with triming a string. I can get rid of the blank space in front and at the back of a string and even trim a string at the back. But I don't know how to do it in the front. For Example: I have a string Blackberry and i want to delete the first 5 characters to get

Re: [R] How to trim the front of a string?

2009-11-21 Thread Jorge Ivan Velez
Hi Ivansek, Here is a suggestion using substr(): x - 'Blackberry' substr(x, 6, nchar(x)) [1] berry HTH, Jorge On Sat, Nov 21, 2009 at 4:05 PM, rok90 wrote: Hey everybody! I have a problem with triming a string. I can get rid of the blank space in front and at the back of a string and

Re: [R] How to trim the front of a string?

2009-11-21 Thread Gabor Grothendieck
Here are three ways: substring(blackberry, 6) [1] berry sub(^black, , blackberry) [1] berry sub(.{5}, , blackberry) [1] berry On Sat, Nov 21, 2009 at 4:05 PM, rok90 ivansek.lab...@gmail.com wrote: Hey everybody! I have a problem with triming a string. I can get rid of the blank space in