knitr::opts_chunk$set(echo = TRUE) suppressMessages(library("frab"))
knitr::include_graphics(system.file("help/figures/frab.png", package = "frab"))
I do not really understand what Wittgenstein was trying to say in
proposition 7 of his Tractatus, but the interpretation of symbols
not present in a frab
object is certainly an interesting problem.
In this short unstructured and informal document, I consider how one
might consider key-value pairs in associative arrays when a particular
key is absent. First, the canonical use-case for frab
objects:
(a <- frab(c(u= -5,v=2,w=1))) (b <- frab(c(v=1,x=2))) a+b
Above we see that a
has no "x"
term, and b
has "x"=2
, the sum
being "x"=2
; we are justified in asserting that, in object b
,
"x"=0
even though it is not present. However, consider this:
(x <- frab(c(a=4, b=-3, c=1, d=-1, e=9))) x[x > -2]
Above we extract every element greater than $-2$. We might say
"extract every element from x
that is known to exceed $-2$". It
has not extracted any absent symbols such as f
, and as such we
cannot associate f
with zero (because zero exceeds $-2$, and no f
element was extracted). But this is not consistent with the a+b
example above, in which absent symbols have the very definite and very
known value of zero.
One might wonder what happens if we try to coerce a named logical
vector to a frab
:
(logvec <- c(x=TRUE,y=FALSE,z=TRUE)) frab(logvec)
[earlier versions of the package allowed the coercion]. However, we
may coerce logvec
to numeric (observe that as.numeric()
loses the
names):
(logvec <- +logvec) # NB as.numeric() loses names frab(logvec)
Above, we see that logvec["y"]
vanishes, being zero. So logical
frab
objects do not make sense as FALSE
entries are discarded.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.