changeType: Change variable type 'changeType' change variable type across...

Description Usage Arguments Value Examples

View source: R/changeType.R

Description

Change variable type changeType change variable type across list of data frame

Usage

1
changeType(x, Var, funct = "as.Date")

Arguments

x

list of data frames

Var

variables or column names

funct

function to change variable type such as.factor(), as.Date(), as.factor(), etc

Value

list of data frames with changed variable type

Examples

1
2
3
4
5
6
7
8
# make a list
iris_list <- list(iris1 = iris, iris2 = iris)

# change one variable type
iris_list <- lapply(iris_list, changeType, Var = "Sepal.Width", funct = "as.character")

# change 2 variables type
iris_list <- lapply(iris_list, changeType, Var = c("Sepal.Length", "Species"), funct = "as.character")

tengku-hanis/niceFunction documentation built on Oct. 27, 2021, 7:41 a.m.