Description Usage Arguments Details Value See Also Examples
Checks a character column in a fishing trip data column. Used by the
check_format
function when checking the format of the input
data.
1 2 | character_column_check(column, column_name, character_correct = FALSE,
missing_correct = FALSE, unknown_value = "UNKNOWN")
|
column |
The column of data from the data.frame. |
column_name |
The name of the column. |
character_correct |
Should non-character strings be forced to be characters. |
missing_correct |
Should missing entries be corrected. |
unknown_value |
The value to replace missing entries with |
This function checks that entries in a data column are character strings.
It is possible to attempt to correct non-character string entries by forcing
them to be characters. The function also checks for missing entries in the
data (either the R value NA
or character strings "NA"
or
""
). It is possible to replace missing entries by a user defined
value. Appropriate messages are printed to the screen.
A list with the column (x
, with or without attempted
corrections) and a flag (ok
) to indicate if the data is OK or has
problems.
This function is used by check_format
.
1 2 3 4 5 | dat <- data.frame(gear = c("OTB","OTB",NA, "NA", ""), gt = 100, stringsAsFactors=FALSE)
# Check with no correction
check <- character_column_check(dat$gear, "gear")
# Check with correction
check <- character_column_check(dat$gear, "gear", missing_correct=TRUE, unknown_value = "NK")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.