knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
I have a problem with basic inheritance of the [
operator for S4 objects that
implement custom arguments. This is a working example from a stackoverflow post
I created.
It was revealed as a bug in the callNextMethod()
implementation and has been
fixed in the upcoming version of R!
https://github.com/wch/r-source/commit/0c06db284ec6d026040d464c3bfea66cf56a09b7
You can install it via github, and it should work:
devtools::install_github("zkamvar/inheritest")
It works if the package is built to your system
library("inheritest") foo <- new("foo", x = pi, y = 2) foo["x"] foo["y", foo = FALSE] bar <- new("bar", x = pi, y = 2, distance = 0) bar["x"] bar["distance", bar = FALSE]
It doesn't work if the package is simply loaded:
In the shell:
git clone https://github.com/zkamvar/inheritest.git
cd inheritest
In R:
devtools::load_all(".") foo <- new("foo", x = pi, y = 2) foo["x"] foo["y", foo = FALSE] bar <- new("bar", x = pi, y = 2, distance = 0) bar["x"] bar["distance", bar = FALSE]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.