FrameCleaner | R Documentation |
This class contains common cleaning routines for data frame objects. The input data frame
may be one of data.frame
, tibble
, or data.table
, but the output data frame will be
a data.table
object. If needed, an object of the original class can be returned by
calling the restore()
method, which returns a copy of the modified data frame with
the original class
attribute.
df
An object that inherits from data.frame
.
col_nms
Column names of the input df
.
ptype
A 0-observation slice of the input df
.
new()
Instantiate a new FrameCleaner
object.
FrameCleaner$new(df)
df
An object that inherits from data.frame
.
A new FrameCleaner
object.
col_nms_trim()
A method for removing leading and trailing white spaces, including
space (' '
), form feed (\f
), line feed (\n
), carriage return (\r'
,
horizontal tab (\t
), and vertical tab (\v
) from column names.
The function modifies the df
field in-place.
FrameCleaner$col_nms_trim()
self
restore()
A method for restoring the original class attribute of the input data frame.
Note that a copy is returned if the original input df
is not a data.table
.
If the original input df
is a data.table
, then this method should be a
no-op.
FrameCleaner$restore()
An object that inherits from data.frame
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.