View source: R/format_observation.R
format_observation | R Documentation |
The focus of this function is to format the dataset but to keep the dataset as original as possible. Then the users can modify the data if they want before put it into this function.
format_observation(
obs_df,
eval_df = NULL,
split_perc = 0.3,
seed = 123,
obs_crs = 4326,
eval_crs = 4326,
x_col = "x",
y_col = "y",
obs_col = "observation",
obs_type = "presence_only"
)
obs_df |
( |
eval_df |
( |
split_perc |
( |
seed |
( |
obs_crs |
( |
eval_crs |
( |
x_col |
( |
y_col |
( |
obs_col |
( |
obs_type |
( |
(FormatOccurrence
) A list of
obs (sf
) the formatted pts of observations.
The column of observation is "observation".
obs_type (character
) the type of the observations,
presence_only or presence_absence.
has_eval (logical
) whether evaluation dataset is set or generated.
eval (sf
) the formatted pts of observations for evaluation if any.
The column of observation is "observation".
eval (eval_type
) the type of the observations for evaluation,
presence_only or presence_absence.
print.FormatOccurrence
library(dplyr)
library(itsdm)
data("occ_virtual_species")
# obs + eval, presence-absence
obs_df <- occ_virtual_species %>% filter(usage == "train")
eval_df <- occ_virtual_species %>% filter(usage == "eval")
x_col <- "x"
y_col <- "y"
obs_col <- "observation"
obs_type <- "presence_absence"
obs <- format_observation(
obs_df = obs_df, eval_df = eval_df,
x_col = x_col, y_col = y_col, obs_col = obs_col,
obs_type = obs_type)
# obs + eval, presence-only
obs_df <- occ_virtual_species %>% filter(usage == "train")
eval_df <- occ_virtual_species %>% filter(usage == "eval")
x_col <- "x"
y_col <- "y"
obs_col <- "observation"
obs_type <- "presence_only"
obs <- format_observation(
obs_df = obs_df, eval_df = eval_df,
x_col = x_col, y_col = y_col, obs_col = obs_col,
obs_type = obs_type)
# obs + eval, different crs, presence-only
obs_df <- occ_virtual_species %>% filter(usage == "train")
eval_df <- occ_virtual_species %>% filter(usage == "eval")
obs_crs <- 4326
# Fake one
eval_crs <- 20935
x_col <- "x"
y_col <- "y"
obs_col <- "observation"
obs_type <- "presence_only"
obs <- format_observation(
obs_df = obs_df, eval_df = eval_df,
obs_crs = obs_crs, eval_crs = eval_crs,
x_col = x_col, y_col = y_col, obs_col = obs_col,
obs_type = obs_type)
# obs + split, presence-absence
obs_df <- occ_virtual_species
split_perc <- 0.5
seed <- 123
obs_crs <- 4326
x_col <- "x"
y_col <- "y"
obs_col <- "observation"
obs_type <- "presence_absence"
obs <- format_observation(
obs_df = obs_df, split_perc = split_perc,
x_col = x_col, y_col = y_col,
obs_col = obs_col, obs_type = obs_type)
# obs, presence-only, no eval
obs_df <- occ_virtual_species
eval_df <- NULL
split_perc <- 0
seed <- 123
obs_crs <- 4326
x_col <- "x"
y_col <- "y"
obs_col <- "observation"
obs_type <- "presence_only"
obs <- format_observation(
obs_df = obs_df, eval_df = eval_df,
split_perc = split_perc,
x_col = x_col, y_col = y_col,
obs_col = obs_col, obs_type = obs_type)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.