[R-gregmisc-users] SF.net SVN: r-gregmisc:[2019] pkg/gtools/R/mixedsort.R
Brought to you by:
warnes
From: <wa...@us...> - 2015-05-08 22:49:30
|
Revision: 2019 http://sourceforge.net/p/r-gregmisc/code/2019 Author: warnes Date: 2015-05-08 22:49:28 +0000 (Fri, 08 May 2015) Log Message: ----------- Summary: Speed up mixedorder by moving suppressWarnings outside of lapply loops. (Suggestion by Henrik Bengtsson.) Modified Paths: -------------- pkg/gtools/R/mixedsort.R Modified: pkg/gtools/R/mixedsort.R =================================================================== --- pkg/gtools/R/mixedsort.R 2015-05-02 17:38:35 UTC (rev 2018) +++ pkg/gtools/R/mixedsort.R 2015-05-08 22:49:28 UTC (rev 2019) @@ -24,12 +24,12 @@ numeric <- function(x) { - suppressWarnings( as.numeric(x) ) + as.numeric(x) } nonnumeric <- function(x) { - suppressWarnings( ifelse(is.na(as.numeric(x)), toupper(x), NA) ) + ifelse(is.na(as.numeric(x)), toupper(x), NA) } x <- as.character(x) @@ -53,10 +53,10 @@ step1 <- lapply( step1, function(x) x[x>""] ) # create numeric version of data - step1.numeric <- lapply( step1, numeric ) + suppressWarnings( step1.numeric <- lapply( step1, numeric ) ) # create non-numeric version of data - step1.character <- lapply( step1, nonnumeric ) + suppressWarnings( step1.character <- lapply( step1, nonnumeric ) ) # now transpose so that 1st vector contains 1st element from each # original string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |