This is a small example demonstrating how to include opticut results into Rmarkdown (Rmd) documents.
library(opticut) library(knitr) ocoptions(cut=-Inf)
We have the following data set:
## community data y <- cbind( Sp1=c(4,6,3,5, 5,6,3,4, 4,1,3,2), Sp2=c(0,0,0,0, 1,0,0,1, 4,2,3,4), Sp3=c(0,0,3,0, 2,3,0,5, 5,6,3,4)) ## stratification g <- c(1,1,1,1, 2,2,2,2, 3,3,3,3)
Here is the real deal:
oc <- opticut(formula = y ~ 1, strata = g, dist = "poisson") summary(oc) oc$species[[1]]
The opticut object and its summary are lists, thus the relevant
information need to be coerced into data frame using
the as.data.frame
method:
kable(as.data.frame(oc))
Single species result is a data frame:
kable(oc$species[[1]], digits=3)
Visualizing the results:
plot(oc)
uc <- uncertainty(oc, type = "asymp", B = 999) summary(uc)
The opticut object and its summary are lists, thus the relevant
information need to be coerced into data frame using
the as.data.frame
method:
kable(as.data.frame(uc))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.