Hi Arnaud, how about this: x=c("1\t\t", "2", "3\t\t\t")
gsub("\t","",x) hth. arnaud chozo schrieb:
Hi all, I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") I need to remove all the occurrences of "\t", in order to obtain: x = "1" "2" "3" I'm trying to use the function substring2, and it works for each component, for example: substring2(x[1], "\t") ="" gives x = "1" "2" " 3\t\t\t" I'd like to apply this function to each component and I tried the following: myfun = function(x, i) { substring2(x[i], "\t") = "" } lapply(x, myfun) which gives x="" "" "" I know that I'm wrong somewhere using lapply, but I can't fix it. Thanks in advance, Arnaud Chozo [[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.
-- Eik Vettorazzi Institut für Medizinische Biometrie und Epidemiologie Universitätsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 ______________________________________________ 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.