| castAllStringsToNA | R Documentation |
This function processes the columns of a given dataset, converting all non-numeric string values
(including factor columns converted to character) to NA. It excludes specified columns from
this transformation. Columns that are numeric or of other types are left unchanged.
castAllStringsToNA(dataset, excludeColumns = c())
dataset |
A data frame containing the dataset to be processed. |
excludeColumns |
A character vector specifying the names of columns to be excluded from processing.
These columns will not have any values converted to |
The function iterates through the specified columns (excluding those listed in excludeColumns),
converts factors to character, and then attempts to convert character values to numeric.
Any non-numeric strings will be converted to NA. This is useful for cleaning datasets that may contain
mixed data types.
A data frame where non-numeric strings in the included columns are replaced with NA, and all other columns remain unchanged.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.