automatic.type.conversion: Try to transform a vector or columns that are stored as...

Description Usage Arguments Examples

View source: R/sktools.r

Description

So far just attempts to convert date and date.times

Usage

1
2
3
4
automatic.type.conversion(x, max.failure.rate = 0.3, quiet = FALSE,
  name = "", cols = NULL, date.class = "POSIX.ct",
  date.time.class = "POSIX.ct", factorsAsStrings = FALSE,
  stringsAsFactors = FALSE, thousand.sep = NULL, ...)

Arguments

x

a vector or data frame that shall be converted

max.failure.rate

maximum share of rows that can be failed to convert so that conversion still takes place

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
  df = data.frame(text=c("c","b","a"),mixed=as.factor(c("a",NA,56)),
    dates = c("1.1.1975","1.1.2010","8.3.1999"),
    date.times = c("1.1.1975 00:10","2010-5-5 12pm","4:30:15"),
    times = c("00:10","12pm",5),
    char.num = as.factor(c("1973","1972","3")),
    half.num = c("145","..","1345")
  )
  df =automatic.type.conversion(df,quiet=FALSE)
  d = df$dates
  d[1]<"1.1.2012"

## End(Not run)

skranz/sktools documentation built on April 12, 2021, 11:43 a.m.