#' Helper function to read SEEM outputs into R
#'
#' @param seem_output An output CSV generated by SEEM.
#' @examples
#' read.seem("seem_outputs.csv")
#'
#'
read.seem<-function(seem_output) {
if(!grepl('SEEM Simulation Model', readLines(seem_output)[1])){
stop('File does not seem to be SEEM Output!')
}
seem <- read.csv(seem_output, stringsAsFactors = F, skip = 6, header = F) # data starts row 7
names(seem) <- read.csv(seem_output, stringsAsFactors = F, skip = 4, nrow = 1, header = F) # (most) column names are in row 5
names(seem) <- gsub('\\$', '', names(seem)) #get
# rename hpwh columns with weird name formats
names(seem)[names(seem) == '1=City Surface 2=City Mix 3=City Ground/Community 4=Well'] <- 'WaterSource'
names(seem)[names(seem) == ' 1=Garage 2=Basement 4=Internal'] <- 'HPWH_location'
names(seem)[names(seem) == ' Number of Column from drawschedule.csv'] <- 'DrawSchedule'
names(seem)[names(seem) == ' Number of Column from DRschedule.csv'] <- 'DRSchedule'
names(seem)[names(seem) == ' Interaction Factor'] <- 'InteractionFactor'
seem$DrawScheduleType <- ifelse(seem$DrawSchedule <= 5, 'daily', 'weekly')
seem$DrawScheduleBRs <- ifelse(seem$DrawSchedule <= 5, seem$DrawSchedule, seem$DrawSchedule - 5)
seem <- seem[, -which(names(seem) == 'DrawSchedule')]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.