# Read simulated community data from the mrangr package
simulated_com <- get_simulated_com()
# Option 1: Randomly sample sites (the same for each year)
sampled_data_01 <- virtual_ecologist(simulated_com)
head(sampled_data_01)
# Option 2: Randomly sample sites (different for each year)
sampled_data_02 <- virtual_ecologist(simulated_com, type = "random_all_layers")
head(sampled_data_02)
# Option 3: Sample sites based on user-provided data frame
custom_sites <- data.frame(
x = c(250500, 252500, 254500),
y = c(600500, 602500, 604500),
time = c(1, 10, 20)
)
sampled_data_03 <- virtual_ecologist(simulated_com, sites = custom_sites)
head(sampled_data_03)
# Option 4. Add noise - "rlnorm"
sampled_data_04 <- virtual_ecologist(
simulated_com,
sites = custom_sites,
obs_error = "rlnorm",
obs_error_param = log(1.2)
)
head(sampled_data_04)
# Option 5. Add noise - "rbinom"
sampled_data_05 <- virtual_ecologist(
simulated_com,
sites = custom_sites,
obs_error = "rbinom",
obs_error_param = 0.8
)
head(sampled_data_05)
Run the code above in your browser using DataLab