Bill, Jim and Martin,
Great! The code is much faster and even looks more R-ish. I'm very new to R
and have some difficulties getting rid my procedural programming habits.
Many thanks to all for the great help.
Olivier.
On Wed, Mar 18, 2009 at 9:38 PM, William Dunlap wrote:
> Olivier,
> You ca
Try this way. Took less than 1 second for 50,000
> system.time({
+ x <- sample(5) # test data
+ x[sample(5,1)] <- 'asdfasdf' # characters strings
+ which.num <- grep("^[ 0-9]+$", x) # find numbers
+ # convert to leading 0
+ x[which.num] <- sprintf("%018.0f", as.
2 matches
Mail list logo