#' Generate missing indicator
#'
#' Generate missing indicator as a new feature
#'
#' @param feature Vector of float numbers representing attribute that miss indicator
#' based on.
#' @param missCode Float number indicating missing status.
#' @param newFieldName Character string used to name generated indicator.
#'
#' @return Vector of 0 and 1's, where 1 means missing and 0 otherwise.
#'
#' @export
#'
#' @examples
#' missFICO_UsedPlat <- miss_ind(feature = Data_UsedPlat$FICO, missCode = 0,
#' newFieldName = 'FICO')
miss_ind <- function(feature, missCode = 0, newFieldName) {
missInd <- as.data.frame( ifelse(feature == missCode, 1, 0) )
names(missInd) <- paste0("miss", newFieldName)
return(missInd)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.