[R] Get the last 3 chars of a string

Sergio Correia sergio.correia at gmail.com
Mon Oct 15 19:27:44 CEST 2007


I want to extract the last 3 letters of a string.

So far, I've done this:

> symbol = 'XYZ.VX"
> substr(symbol,nchar(symbol)-2,nchar(symbol))
[1] ".VX"

It works, but the code looks UGLY as hell. Am I missing something? Or
is this the way it's supposed to be?

Thanks,
Sergio

On 10/15/07, pintinho <diego at bpgomes.com> wrote:
>
> Hi everyone,
>
> When I try to import data do R, the following message appears: "\Uxxxxxxxx
> sequences are not supported on Windows".
>
> I tried lots of methods to import (read.csv, read.table, RODBC, read.delim)
> and the same message appears for all these methods. I think it is a bigger
> problem.
>
> Can anyone help me solving this issue?
>
> Thanks a lot.
>
>
>
> --
> View this message in context: http://www.nabble.com/ERROR-while-importing-data-tf4628752.html#a13216707
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list