Displaying 1 result from an estimated 1 matches for "cleanread".
Did you mean:
cleaned
2010 Jul 21
3
String processing - is there a better way
I have a two part question
Part 1)
I am trying to remove characters in a string based on the position of a key character in another string.? I have a solution that works but it requires a 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...