search for: ysplit

Displaying 1 result from an estimated 1 matches for "ysplit".

Did you mean: split
2010 Jul 21
3
String processing - is there a better way
...for-loop.? A vectorized way of doing this has alluded me.? CleanRead<-function(x,y) { ? if (!is.character(x)) ??? x <- as.character(x) ? if (!is.character(y)) ??? y <- as.character(y) ? idx<-grep("\\*", x, value=FALSE) ? starpos<-gregexpr("\\*", x[idx]) ? ? ysplit<-strsplit(y[idx], '') ? n<-length(idx) ? for(i in 1:n) { ??? ysplit[[i]][starpos[[i]]] = "" ? } ? y[idx]<-unlist(lapply(ysplit, paste, sep='', collapse='')) ? return(y) } x<-c("AA*.*A,,,", "**a.a*,,,A", "C*c..", "**a...