> test <- "xyz" > nchar(test) [1] 3 > n <- nchar(test) > n <- n-1 > substr(test,1,n) [1] "xy"
Kjetil Halvorsen
Luis Rideau Cruz wrote:
R-help,
Any function to remove last element (or any specific elemnet in the sequence) from a character string?
t<-c("aaab","qqqc")
function(t) ### remove last character (b and c respectively)
aaa qqq
Thanks
`�._ .� `�. _ .� `�._ .� `�. _ .� `�._ .� `�. _ .� `�.. Luis Ridao Cruz Fiskiranns�knarstovan N�at�n 1 P.O. Box 3051 FR-110 T�rshavn Faroe Islands Phone: +298 353900 Phone(direct): +298 353912 Mobile: +298 580800 Fax: +298 353901 E-mail: [EMAIL PROTECTED] Web: www.frs.fo
`�._ .� `�. _ .� `�._ .� `�. _ .� `�._ .� `�. _ .� `�..
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
