This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Library Name myLibrary <- "MMIcalc" # "ContDataQC","MMIcalc","MMIcalcNV","MBSStools","XC95" # Load Library library(devtools) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create Package # create(myLibrary) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # files to library folder # file.copy("metric.values.R","./Library/MMIcalc/R/metric.values.R",overwrite=TRUE) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Document, Install, and Reload Library myLibrary <- "MMIcalc" ## Generate Documentation setwd(paste0("./",myLibrary)) devtools::document() ## Install New Package (locally) setwd("..") # return to root directory first devtools::install(myLibrary) ## Reload library library(myLibrary,character.only = TRUE) # change wd back to package setwd(paste0("./",myLibrary)) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Restart R within RStudio: Ctrl + Shift + F10 library(MMIcalc) ?metric.values
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).
# Bugs myDF <- myDF.Bugs SampleID <- "SampleID" MetricNames <- myMetrics.Bugs # Fish myDF <- myDF.Fish SampleID <- "SampleID" MetricNames <- myMetrics.Fish
write.csv(myMetric.Values.Bugs,"bibi_genus.csv")
myDF.Bugs <- taxa_bugs_genus x <- myDF.Bugs y <- subset(myDF.Bugs, StationID=="PATL-B05-X-2016")
Reference table
Method = Observed / Expected
Calculation of Expected (E) Linear is y = m*x +b
MBSS has 1 metric, nt_benthic, that is in 3 of the 4 strata that needs adjustment.
myMetric.Values.Fish[,"nt_benthic_Obs"] <- myMetric.Values.Fish[,"nt_benthic"] # Expected constants ## m myMetric.Values.Fish[,"nt_benthic_m"] <- NA myMetric.Values.Fish[,"nt_benthic_m"][myMetric.Values.Fish[,"Index.Region"]=="COASTAL"] <- 1.69 myMetric.Values.Fish[,"nt_benthic_m"][myMetric.Values.Fish[,"Index.Region"]=="EPIEDMONT"] <- 1.25 myMetric.Values.Fish[,"nt_benthic_m"][myMetric.Values.Fish[,"Index.Region"]=="HIGHLAND"] <- 1.23 ## b myMetric.Values.Fish[,"nt_benthic_b"] <- NA myMetric.Values.Fish[,"nt_benthic_b"][myMetric.Values.Fish[,"Index.Region"]=="COASTAL"] <- -3.33 myMetric.Values.Fish[,"nt_benthic_b"][myMetric.Values.Fish[,"Index.Region"]=="EPIEDMONT"] <- -2.36 myMetric.Values.Fish[,"nt_benthic_b"][myMetric.Values.Fish[,"Index.Region"]=="HIGHLAND"] <- -2.35 # Calc Expected myMetric.Values.Fish[,"nt_benthic_Exp"] <- (myMetric.Values.Fish[,"nt_benthic_m"] * log10(myMetric.Values.Fish[,"Catchment"])) + myMetric.Values.Fish[,"nt_benthic_b"] # Calc Adjusted myMetric.Values.Fish[,"nt_benthic_Adj"] <- myMetric.Values.Fish[,"nt_benthic_Obs"] / myMetric.Values.Fish[,"nt_benthic_Exp"] # Rename base metric with adjusted value myMetric.Values.Fish[,"nt_benthic"] <- myMetric.Values.Fish[,"nt_benthic_Adj"]
Catchment Area (acres)
Stream width (m) and length (always 75m) to get area
not for MBSS but others will need DELT and biomass.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.