ez.str: convert a column (or all columns) in a data frame, or a...

View source: R/basic.R

ez.strR Documentation

convert a column (or all columns) in a data frame, or a vector into character type, call as.character

Description

convert a column (or all columns) in a data frame, or a vector into character type, call as.character

Usage

ez.str(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 cols in x
if x is a data frame, col is NA (a special case), convert all numeric NAs to character NAs, for bind_rows. see https://github.com/tidyverse/dplyr/issues/2584
if x is not a data frame, col is ignored

Details

Both value and variable label attributes will be removed 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.2char

Other data transformation functions: ez.2char(), 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.unique(), left_join()


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