Skip to content
Prev 67482 / 398506 Next

removing characters from a string

look at "?gsub()", e.g.,

string <- "ab03def10-523rtf"
string
gsub("[^0-9]", "", string)
gsub("[0-9]", "", string)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Vivek Rao" <rvivekrao at yahoo.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, April 12, 2005 2:54 PM
Subject: [R] removing characters from a string