convert: Convert data type of columns

convertR Documentation

Convert data type of columns

Description

Convert data type of columns

Usage

num(..., .args = list())

chr(..., .args = list())

lgl(..., .args = list())

int(..., .args = list())

dbl(..., .args = list())

fct(..., .args = list())

dtm(..., .args = list())

dte(..., .args = list())

convert(.x, ...)

Arguments

...

Scoping functions, see details

.args

extra argument to be passed to support function.

.x

A data.frame

Value

a tbl data frame

See Also

vignette("convert"), vignette("hablar")

Examples

## Not run: 

# Change one column to numeric and another to character
mtcars %>% 
  convert(num(gear),
          chr(mpg))


# Changing multiple data types on multiple columns
mtcars %>% 
  convert(int(hp,
              wt),
          fct(qsec,
              cyl,
              drat))

# Also works with tidyselect convenience functions
mtcars %>%
  convert(int(vs:carb),
          fct(last_col()))


## End(Not run)


hablar documentation built on March 31, 2023, 11:54 p.m.