## Using 'formula' (long format)
rarefaction(
formula = Species ~ Plot - Morta,
data = quadrat.df,
plot = TRUE
)
# \donttest{
## Using different plot themes
rarefaction(
formula = Species ~ Plot - Morta,
data = quadrat.df,
plot = TRUE,
theme = "theme_light"
)
rarefaction(
formula = Species ~ Plot - Morta,
data = quadrat.df,
plot = TRUE,
theme = "theme_bw"
)
rarefaction(
formula = Species ~ Plot - Morta,
data = quadrat.df,
plot = TRUE,
theme = "theme_minimal"
)
## Using a matrix (wide format)
data.matrix <- with(
quadrat.df,
table(Plot, Species, exclude = "Morta")
)
rarefaction(x = data.matrix, plot = TRUE)
data.matrix <- as.matrix(
xtabs(~ Plot + Species, data = quadrat.df, exclude = "Morta")
)
rarefaction(x = data.matrix, plot = TRUE)
## Using a vector
data.vector <- sort(
as.vector(apply(data.matrix, 2, sum)),
decreasing = TRUE
)
rarefaction(x = data.vector, plot = TRUE)
## Using breakpoints
pts <- c(1, 10, 30, 50, 80)
rarefaction(
formula = Species ~ Plot - Morta,
data = quadrat.df,
points = pts,
plot = TRUE
)
rarefaction(x = data.matrix, points = pts, plot = TRUE)
rarefaction(
x = data.vector,
points = pts,
plot = TRUE,
theme = "theme_light"
)
rarefaction(x = data.vector, points = 50, plot = FALSE)
# }
Run the code above in your browser using DataLab