knitr::opts_chunk$set(results='asis', echo=FALSE, warning=FALSE) # needed for trouble shooting #myConfig <- file.path(system.file(package="ContDataQC"), "extdata", "config.ORIG.R") #source(myConfig)
# Report Info myReportDate <- format(Sys.Date(),ContData.env$myFormat.Date) cat(paste("**Report Date:** ",myReportDate,"\n\n",sep="")) myUser <- Sys.getenv("USERNAME") cat(paste("**Generated By:** ",myUser,"\n\n",sep="")) #filename cat("**Filename:** ",strFile,"\n\n",sep="") cat(paste("**SiteID:** ",strFile.SiteID,"\n\n",sep="")) cat(paste("**Period of Record, Requested:** ",fun.myData.DateRange.Start," to ",fun.myData.DateRange.End,sep="",collapse="\n\n")) # myTimeDiff <- difftime(data.import[11,ContData.env$myName.DateTime],data.import[10,ContData.env$myName.DateTime],units="mins") #x <- data.import[,ContData.env$myName.DateTime] myT <- strptime(data.import[,ContData.env$myName.DateTime],format=ContData.env$myFormat.DateTime) myTimeDiff.all <- difftime(myT[-1],myT[-length(myT)],units="mins") myTimeDiff <- median(as.vector(myTimeDiff.all),na.rm=TRUE) cat(paste("\n\n**Period of Record, Actual:** ",min(data.import[,myName.Date])," to ",max(data.import[,myName.Date]),"\n\n",sep="")) cat(paste("**Recording Interval:** ",myTimeDiff[1]," minutes\n\n",sep="")) cat(paste("**Data Type:** ",strFile.DataType,"\n\n",sep="")) # need to do better myParameters <- ContData.env$myNames.DataFields[ContData.env$myNames.DataFields %in% names(data.import)==TRUE] myParameters.Lab <- ContData.env$myNames.DataFields.Lab[ContData.env$myNames.DataFields %in% names(data.import)==TRUE] #cat("**Parameters:** ",paste(myParameters.Lab,", ",sep=""),"\n\n",sep="") # above line not working, preventing pandoc conversion to WORD #cat("**Included Parameters:** \n\n") cat("**Parameters Included:** ",paste(myParameters,", ",sep=""),"\n\n",sep="")
Summary statistics and plots by parameter and time frame (year, season, month, and daily)
# # 3. Data Info, by Parameter # # Individual Data Type Report # # QC # #i <- myParameters[1] # for (i in myParameters) {##FOR.i.START # # # # i.num <- match(i,myParameters) # myTitle.Sub <- myParameters.Lab[i.num] # # # cat("## QC TESTS, ",i,"\n\n",sep="") # # #cat(paste("**QC TESTS,",myTitle.Sub,sep="")) # # # 3.1. Flags, overall # cat(myTitle.Sub <- "### Flags") # cat("\n\n") # cat("#### Flag summary, overall number of records.") # cat("\n\n") # myTable <- table(data.import[,paste("Flag",i,sep=".")]) # print(knitr::kable(t(as.matrix(myTable)), format = "markdown")) # # cat("\n\n") # # # # # 3.1.A Records by Month/Day # cat("Month and Day versus number of records.") # cat("\n\n") # # split so easier to put on paper # # number of records by month/day (split 1:15 and 16:31) # # filter for records by parameter that are not NA # myTable <- table(data.import[,"month"][data.import[,"day"]<=15 & !is.na(data.import[,i]) & data.import[,i]!=""],data.import[,"day"][data.import[,"day"]<=15 & !is.na(data.import[,i]) & data.import[,i]!=""]) # #print(myTable) # print(knitr::kable(as.matrix(myTable)), format = "markdown") # # don't (t)ransform this table # # myTable <- table(data.import[,"month"][data.import[,"day"]>15 & !is.na(data.import[,i]) & data.import[,i]!=""],data.import[,"day"][data.import[,"day"]>15 & !is.na(data.import[,i]) & data.import[,i]!=""]) # #print(myTable) # print(knitr::kable(as.matrix(myTable)), format = "markdown") # # don't (t)ransform this table # # # # # # # cat("\n\n") # # # Convert time interval (minutes) to number per day # records.expected <- 24*60/as.numeric(myTimeDiff[1]) # # cat(paste("Expected number of records per day is ",records.expected,".",sep="")) # # # identify days/months where not the expected number of records # # (expect first and last day) # # print("days where not the expected number of records") # # # # 3.2. Flags by QC Test # # cat("\n\n") # # cat("#### Flags by QC Test") # # cat("\n\n") # # cat("##### Flags, Gross\n\n") # # myTable <- table(data.import[,paste("Flag.Gross",i,sep=".")]) # print(knitr::kable(t(as.matrix(myTable)), format = "markdown")) # cat("\n\n") # cat("##### Flags, Spike\n\n") # # myTable <- table(data.import[,paste("Flag.Spike",i,sep=".")]) # print(knitr::kable(t(as.matrix(myTable)), format = "markdown")) # cat("\n\n") # cat("##### Flags, RoC\n\n") # # myTable <- table(data.import[,paste("Flag.RoC",i,sep=".")]) # print(knitr::kable(t(as.matrix(myTable)), format = "markdown")) # cat("\n\n") # cat("##### Flags, Flat\n\n") # # myTable <- table(data.import[,paste("Flag.Flat",i,sep=".")]) # print(knitr::kable(t(as.matrix(myTable)), format = "markdown")) # cat("\n\n") # cat("QC Test Flag fields are saved in the data file so the user can identify data points that have been flagged as suspect or fail.") # # # # #myFlagTests <- c("Gross","Spike","RoC","Flat") # #(myTable.Flags.Flat <- ftable(data.import[,paste("Flag",myFlagTests,i,sep=".")])) # # # # # cat("\n\n Test results marked as 9 (Missing Data) if unable to calculate the end point needed for the test. For example, the first record does not have a previous record for comparison for the Gross QC Test. QC Test flags are saved in the data file.") # # # # # 3.3. Plot # data.plot <- data.import # # # # cheat on Date/Time axis # n.Total <- length(data.plot[,myName.Date]) # pct <- c(20,40,60,80,100)*.01 # myAT <- c(1,round(n.Total * pct,0)) # myLab <- data.plot[,myName.Date][myAT] # # # myPlot.Y <- data.plot[,i] # myPlot.Ylab <- myParameters.Lab[i.num] # plot(myPlot.Y,type="l",main=fun.myData.SiteID,xlab=myLab.Date,ylab=myPlot.Ylab,col="gray", xaxt="n") # axis(1,at=myAT,labels=myLab,tick=TRUE) # # cat("\n\n") # # # # }##FOR.i.END
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.