#Load Libraries library(amstools) library(amsdata) library(ggplot2) library(dplyr) library(knitr) library(odbc) options(digits = 4) #set parameters- from, to, sys not used if loading from file from <- as.Date('2014-09-01') sys <- 'both' #cfams, usams, ams1 or both #Pull the data ss <- getStandards(from, sys = sys, rec = params$rec) # get sample name db <- conNOSAMS() name <- dbGetQuery(db, paste("select cl_id from logged_sample where rec_num =", params$rec))
Determination of mean fm and error for r name
, rec num r sprintf('%i', params$rec)
, from r from
to present.
Data pulled from no_os by rec_num.
ggplot(ss, aes(f_modern)) + geom_histogram() + ggtitle("Fm distribution")
Remove clear outliers. Discard points > 1.5 * interquartile range.
ss <- ss %>% mutate(f_modern = removeOutliers(f_modern)) # weighted means wm <- weighted.mean(ss$f_modern, ss$f_ext_error, na.rm = TRUE)
That leaves us with N = r length(ss$f_modern[!is.na(ss$f_modern)])
, mean = r mean(ss$f_modern, na.rm = TRUE)
, weighted mean = r wm
, sd = r sd(ss$f_modern, na.rm = TRUE)
.
ggplot(ss, aes(f_modern)) + geom_histogram() + ggtitle("Fm distribution", subtitle = "Outliers removed")
kable(select(ss, tp_num, tp_date_pressed, wheel, gf_co2_qty, f_modern, f_ext_error), caption = "Data without outliers")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.