Permalink
Browse files

char2num now correctly handles negative numbers

  • Loading branch information...
kkholst committed Sep 25, 2017
1 parent 517b5dc commit 480cb424b11f12bb5560d6bdf58f5e828ccf37b8
Showing with 1 addition and 1 deletion.
  1. +1 −1 R/utils.R
View
@@ -1,5 +1,5 @@
char2num <- function(x,...) {
idx <- grep("^[0-9\\.]+",x,perl=TRUE,invert=TRUE)
idx <- grep("^[-]*[0-9\\.]+",x,perl=TRUE,invert=TRUE)
if (length(idx)>0) x[idx] <- NA
as.numeric(x)
}

0 comments on commit 480cb42

Please sign in to comment.