Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
Although imputation is the methodically sound way to go in most cases, sometimes I find myself performing imputations at the very end of pre-processing (mostly with time series). Therefore, it would be nice to have a NA remove feature in the spatialSign function:
"spatialSign.default" <- function(x) { if(is.character(x) | is.factor(x)) stop("spatial sign is not defined for character or factor data") denom <- sum(x^2, na.rm = TRUE) out <- if(sqrt(denom) > .Machine$double.eps) x / sqrt(denom) else x * 0 out }Conceptually, this is equivalent to treating NAs as zeros, which is very often at least not totally wrong.