I wrote: > If anyone can tell me how to vectorise this, I would be glad of the lesson. where "this" was > strrev <- > function (s) paste(rev(strsplit(s, character(0))[[1]]), collapse="")
Thomas Lumley <[EMAIL PROTECTED]> suggested strrev<- function(ss) { sapply(lapply( strsplit(ss,character(0)), rev), paste, collapse="") } Unfortunately, I failed to explain myself clearly, so this doesn't actually answer the question I _meant_ to ask. For me, sticking in some variant of 'apply' means you have _failed_ to vectorise. The string reversal code in ?rev doesn't count for the same reason. There is no reason why a built-in strrev() couldn't be as vectorised as most built-ins, it's just not common enough to deserve a lot of effort. ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help