View source: R/generate_random_class.R
generate_random_class | R Documentation |
A function to create random multiclass data. This function allows you to create random spatial data for a specified number of classes (num_class) and replicates (num_rep)
generate_random_class(data, num_class, num_rep, return_sf = TRUE)
data |
Input extent of data 'sf', 'sp', or 'Vect' |
num_class |
number of required classes |
num_rep |
replication for each class |
return_sf |
(logical) if true returns 'sf' object using coordinate system of input data |
If 'return_sf' is TRUE, the function returns an 'sf' object containing the generated classes. If 'return_sf' is FALSE, the function returns a data frame containing the generated classes.
# Load sample data
data("landcover")
# Generate random classes with 5 classes and 100 replicates per class
samp_data <- generate_random_class(landcover, 5, 100,return_sf = FALSE)
head(samp_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.