Blogger

Delete comment from: theBioBucket*

Anonymous said...

set.seed(1)
x <- sample(0:100, 1E7, replace=TRUE, prob=c(0.5, rep(0.005, 100)))
system.time(ifelse(x > 0, 1, 0))
user system elapsed
7.092 2.488 9.634
system.time(as.numeric(x > 0))
user system elapsed
0.344 0.280 0.629

For real biological datasets this is probably trivial (10 million records is perhaps far-fetched!).

Feb 23, 2012, 6:43:37 AM


Posted to Transformation of Several Variables in a Dataframe

Google apps
Main menu