library(knitr)

# the default output hook
hook_output = knitr::knit_hooks$get('output')
knitr::knit_hooks$set(output = function(x, options) {
  if (!is.null(n <- options$out.lines)) {
    x <- unlist(strsplit(x, '\n', fixed = TRUE))
    if (length(x) > n) {
      # truncate the output
      x <- c(head(x, n), '....', '')
    } else {
      x <- c(x, "")
    }
    x <- paste(x, collapse = '\n') # paste first n lines together
  }
  hook_output(x, options)
})

knitr::opts_knit$set(root.dir = tempdir())
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

# Make sure the date is shown in English format not Chinese.
invisible(Sys.setlocale(category = "LC_TIME", locale = "en_US.UTF-8"))

eplusbuildr

Travis-CI Build Status AppVeyor Build Status codecov CRAN_Status_Badge CRAN Checks CRAN Download Badge

A collection of useful functions to work with eplusr.

Installation

Currently eplusbuidr is not on CRAN yet. You can install the development version from GitHub.

# install.packages("remotes")
remotes::install_github("hongyuanjia/eplusbuildr")

Get started

library(eplusr)
library(eplusbuildr)

# read model
idf <- read_idf(file.path(eplus_config(8.8)$dir, "ExampleFiles", "RefBldgLargeHotelNew2004_Chicago.idf"))

# Remove not-used objects
purge_object(idf, "Material")

# Merge same objects into one
merge_object(idf, "Schedule:Compact")

# Rename objects using function
# purrr-like function definition supported
idf$object_name("ZoneHVAC:FourPipeFanCoil")

rename_per_fun(idf, "ZoneHVAC:FourPipeFanCoil",
    ~gsub("fan coil", "four-pipe fan coil", .x)
)

idf$object_name("ZoneHVAC:FourPipeFanCoil")

# Rename objects based on class and fielf values
idf$object_name("People")

rename_per_field(idf, "People", "Zone or ZoneList Name")

idf$object_name("People")

Author

Hongyuan Jia

License

The project is released under the terms of MIT License.

Copyright © 2019 Hongyuan Jia



hongyuanjia/eplusbuildr documentation built on Jan. 11, 2020, 2:05 a.m.