ez.2char: factor 2 char

View source: R/frame.R

ez.2charR Documentation

factor 2 char

Description

convert a column of factor type (or all factor columns) in a data frame into character type as.character(). Check with is.factor(). If not is.factor(), remain untouched.

Usage

ez.2char(x, col = NULL)

Arguments

x

a data frame or a vector/col

col

internally evaluated by eval('dplyr::select()')
if x is a data frame, col is specified (e.g., "cond"), convert that col only.
if x is a data frame, col is unspecified (i.e., NULL default), convert all possible factor cols in x
if x is not a data frame, col is ignored

Details

Both value and variable label attributes will be kept when converting variables to characters.

Value

returns a character vector or a data frame with changed col(s)

Note

ez.2char only coverts factor, ez.str coverts all types, both use as.character

See Also

ez.str

Other data transformation functions: ez.2factor(), ez.2label(), ez.2long(), ez.2lower(), ez.2value(), ez.2wide(), ez.compute(), ez.del(), ez.label.get(), ez.label.set(), ez.labels.get(), ez.labels.set(), ez.move(), ez.newcol(), ez.num(), ez.recode(), ez.recols(), ez.recol(), ez.rename(), ez.replace(), ez.rncols(), ez.rncol(), ez.select(), ez.sort(), ez.split(), ez.str(), ez.unique(), left_join()


jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.