Learn R Programming

creditmodel (version 1.0)

char_to_num: character to number

Description

char_to_num is for transfering character variables which are actually numerical numbers containing strings to numeric.

Usage

char_to_num(dat, note = FALSE,
  ex_cols = "date$|id$|time$|DATA$|ID$|TIME$")

Arguments

dat

A data frame

note

Logical, outputs info. Default is TRUE.

ex_cols

A list of excluded variables. Regular expressions can also be used to match variable names. Default is NULL.

Value

A data.frame

Examples

Run this code
# NOT RUN {
dat_sub = lendingclub[c("mths_since_recent_revol_delinq", "mths_since_last_record")]
str(dat_sub)
#variables that are converted to numbers containing strings
dat_sub[is.na(dat_sub)] = "Unknown"
str(dat_sub)
dat_sub = char_to_num(dat_sub)
str(dat_sub)
# }

Run the code above in your browser using DataLab