View source: R/initial_cleaning.R
| initial_cleaning | R Documentation |
Simple occurrence data cleaning procedures.
initial_cleaning(data, species, x, y,
other_columns = NULL, keep_all_columns = TRUE,
sort_columns = TRUE, remove_na = TRUE, remove_empty = TRUE,
remove_duplicates = TRUE, by_decimal_precision = FALSE,
decimal_precision = 0, longitude_precision = NULL,
latitude_precision = NULL)
sort_columns(data, species, x, y, keep_all_columns = FALSE)
remove_missing(data, columns = NULL, remove_na = TRUE,
remove_empty = TRUE, keep_all_columns = TRUE)
remove_duplicates(data, columns = NULL, keep_all_columns = TRUE)
remove_corrdinates_00(data, x, y)
filter_decimal_precision(data, x,
y, decimal_precision = 0,
longitude_precision = NULL,
latitude_precision = NULL)
data |
data.frame with occurrence records. |
species |
(character) name of the column in |
x |
(character) name of the column in |
y |
(character) name of the column in |
other_columns |
(character) vector of other column name(s) in
|
keep_all_columns |
(logical) whether to keep all columns in |
sort_columns |
(logical) whether to sort species, longitude, and
latitude columns in |
remove_na |
(logical) whether to remove NA values in the columns considered. Default = TRUE. |
remove_empty |
(logical) whether to remove empty (missing) values in the columns considered. Default = TRUE. |
remove_duplicates |
(logical) whether to remove duplicates in the columns considered. Default = TRUE. |
by_decimal_precision |
(logical) whether to remove certain records with coordinate precision lower than that of the following three parameters. Default = FALSE |
decimal_precision |
(numeric) decimal precision threshold for coordinates. Default = 0. Ignored if the following two parameters are defined. |
longitude_precision |
(numeric) decimal precision threshold for longitude. Default = NULL. |
latitude_precision |
(numeric) decimal precision threshold for latitude. Default = NULL. |
columns |
(character) vector of additional column name(s) in
|
Function initial_cleaning helps to perform all simple steps of data
cleaning.
A data.frame with resulting occurrence records.
advanced_cleaning
# Import occurrences
data(occ_data_noclean, package = "kuenm2")
# remove missing data
mis <- remove_missing(data = occ_data_noclean, columns = NULL, remove_na = TRUE,
remove_empty = TRUE)
# remove exact duplicates
mis_dup <- remove_duplicates(data = mis, columns = NULL, keep_all_columns = TRUE)
# remove records with 0 for x and y coordinates
mis_dup_00 <- remove_corrdinates_00(data = mis_dup, x = "x", y = "y")
# remove coordinates with low decimal precision.
mis_dup_00_dec <- filter_decimal_precision(data = mis_dup_00, x = "x", y = "y",
decimal_precision = 2)
# all basic cleaning steps
clean_init <- initial_cleaning(data = occ_data_noclean, species = "species",
x = "x", y = "y", remove_na = TRUE,
remove_empty = TRUE, remove_duplicates = TRUE,
by_decimal_precision = TRUE,
decimal_precision = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.