Dear Jonas,
Try this:

> v<- c('stratosphere', 'mesosphere', 'troposphere')
> substr(v,3,4)
[1] "ra" "so" "op"

See ?substr for more information.

HTH,

Jorge


On Sat, May 16, 2009 at 9:52 AM, jonas garcia <garcia.jonas80@googlemail.com
> wrote:

> Dear R users:
>
>
>
> I have got a simple question that has been bothering me for a while.
>
> Given a certain character vector, I would like to get in a separate vector
> a
> fragment of text, in this case the 3rd and 4th letters of each element.
>
>
>
> So, if:
>
>
>
> v<- c(“stratosphere”, “mesosphere”, “troposphere”)
>
>
>
> I want to obtain a different vector like this:
>
>
>
> c(“ra”, “so”, “op”)
>
>
>
> Thanks in advance for your help
>
>
>
> Jonas
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>

	[[alternative HTML version deleted]]


