HAHA! I accidentally did a find and replace for " ", replacing with ""! good thing this was a pretty small notebook! I'm only going to fix what I need now.
knitr::opts_chunk$set(echo=TRUE)
workingontimezoneconversion.
IhavetheOlsonnamesforeachrowinawqpdataset.FromthisIcan:
-createadatetimeobjectusingtheOlsonname -formatitasUTCtime -reconverttoPOSIXct
times<-startdt olsons<-wqpTZ head(times) head(olsons) toUTC_oneTZ<-function(timestring,olsonstring,...){ psx1<-as.POSIXct(timestring,tz=olsonstring,...) psx2<-as.POSIXct(format(psx1,tz="UTC",usetz=TRUE),tz="UTC") } toUTC<-function(timestring,olsonstring){ olsonstring<-as.factor(olsonstring) timelist<-split(timestring,f=olsonstring) utcList<-Map(toUTC_oneTZ,timestring=timelist,olsonstring=levels(olsonstring)) } utctimes<-toUTC(times,olsons) head(utctimes)
That'spretty.I'mproudofthat.
SoImovedthattothepackage,withsomeimprovementsandaddedtests.Nowwqp_checkTZappearstowork.
NextI'mmakingafunctiontoaverageoverdepth.FirstIwanttoseeifIneedtoperformchecks,e.g.usingthecommenttext.
summary(as.factor(no3Data$ResultDepthAltitudeReferencePointText)) summary(as.factor(no3Data$ActivityDepthAltitudeReferencePointText)) no3Data%>% group_by(ActivityDepthAltitudeReferencePointText)%>% summarize(nas=sum(is.na(ActivityDepthHeightMeasure.MeasureValue)), n=n()) no3Data%>% filter(is.na(ActivityDepthAltitudeReferencePointText))%>% select(ActivityDepthHeightMeasure.MeasureValue)%>% summary() no3Data%>% filter(ActivityDepthAltitudeReferencePointText=="Belowland-surfacedatum")%>% glimpse()
LookslikeIneedtomakeawqp_checkDepth
function.ThisiswhereIshouldputtheunitconversionfordepth--notcheckUnits.
DONE.
NowestablishwhetherResultDepth...everprovidesadditionalinformationtoActivityDepth...
nitrateData%>% filter(is.na(ActivityDepthHeightMeasure.MeasureValue), !is.na(ResultDepthHeightMeasure.MeasureValue))%>% glimpse
Nope!
Ugh,somethingnotworkingrightinmysummaryofsimplifiedconcentrationdata.
simp %>% group_by_(.dots = c("Date", "station", "char", "frac", "conc.units", "conc.flag", "detlim", "is.bdl")) %>% summarize(conc = mean(conc)) simp %>% group_by_(~Date, ~station)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.