[R] drop last character in a names'vector

Sebastian Kruk residuo.solow at gmail.com
Sat May 1 00:44:44 CEST 2010

Hi, i have a vector filled with names:

[1] Alvaro Adela ...
[25] Beatriz Berta ...
[100000] ...

I would like to drop last character in every name.

I use the next program:

for (i in 1:100000) {
                          largo <- nchar(names[i]-1)
                          names[i] <- substring (names[i],1,largo]

Is another and faster way of do it?



More information about the R-help mailing list