run <- FALSE
root_dir <- paste(rep("../", 1), collapse = "")
knitr::opts_chunk$set(comment = "#>", collapse = TRUE)
knitr::opts_knit$set(root.dir = root_dir)

TODO

Create instance

createInstance(of = "test_class")
createInstance(of = "test_class", with = letters[1:3])
createInstance(of = "test_class", with = letters[1:3])
createInstance(of = "test_class", with = letters[1:3],
  attributes = list(attr_1 = TRUE, attr_2 = "yep!"))
createInstance(of = "test_class", with = letters[1:3],
  attributes = list(my_attrs = list(attr_1 = TRUE, attr_2 = "yep!")))

Use in S3 methods

Create methods

foo <- function(x, ...) {
  UseMethod("foo", x)
}

foo.test_class <- function(x, ...) {
  print("hello world")
}

Call methods

x <- createInstance("test_class")
foo(x)


rappster/instancer documentation built on May 26, 2019, 11:17 p.m.