Re: [R] Profiling question: string formatting extremely slow

2009-03-18 Thread Olivier Boudry
ause > one of its arguments is 0-long). > > Bill Dunlap > TIBCO Software Inc - Spotfire Division > wdunlap tibco.com > ---------------- > --- > [R] Profiling question: string formatting extremely slow > > jim h

Re: [R] Profiling question: string formatting extremely slow

2009-03-18 Thread jim holtman
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.

[R] Profiling question: string formatting extremely slow

2009-03-18 Thread Olivier Boudry
Hi all, I'm using R to find duplicates in a set of 6 files containing Part Number information. Before applying the intersect method to identify the duplicates I need to normalize the P/Ns. Converting the P/N to uppercase if alphanumerical and applying an 18 char long zero padding if numerical. Wh