Print free objects
print.Rd
Print methods for free objects
Arguments
- x
Object of class
free
in the print method- m
A two-row matrix in function
as.character_free()
- latex
Boolean, with
TRUE
meaning to print latex-friendly output including curly braces, and defaultNULL
option meaning to give a nicer-looking output that latex would typeset incorrectly- ...
Further arguments, currently ignored
Note
The print method does not change the internal representation of a
free
object, which is a list of integer matrices.
The default print method uses multiplicative notation (powers) which is
inconsistent with the juxtaposition method “+
”.
The print method has special dispensation for length-zero free objects but these are not handled entirely consistently.
The default print method uses lowercase letters a-z, but it is possible
to override this using options("freegroup_symbols" = foo)
, where
foo
is a character vector. This is desirable if you have more
than 26 symbols, because unallocated symbols appear as NA
.
The package will allow the user to set
options("freegroup_symbols")
to unhelpful things like
rep("a",20)
without complaining (but don't actually do it, you
crazy fool).
Examples
## default symbols:
abc(26)
#> [1] a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z
rfree(1,10)
#> [1] c^-10.a^-2.d^2.f^9.i^4.a^-8.d^-1.a^-10
# if we need more than 26:
options(freegroup_symbols=state.name)
rfree(10,4)
#> [1] Alaska^6.Arizona^3
#> [2] Arizona.Alaska^2.Arkansas^-5
#> [3] Arkansas^-4.Alabama.Alaska.Arizona^-1
#> [4] Arkansas^-2.Alaska^-3.Arkansas^3.Arizona^2
#> [5] Alaska^-3.Alabama^2.Arkansas
#> [6] Alabama^2.Arkansas^2.Arizona^-4
#> [7] Alabama^-4.Alaska^4.Arizona.Arkansas^4
#> [8] Alabama^3.Arkansas^4.Arizona^4
#> [9] Alaska^8.Alabama^4.Arizona
#> [10] Arkansas^-2.Arizona
# or even:
jj <- letters[1:10]
options(freegroup_symbols=apply(expand.grid(jj,jj),1,paste,collapse=""))
rfree(10,10,100,4)
#> [1] fa^2.ad^3.fc^3.ac.gg^3.fg^2.ej^4.gc.ad^4
#> [2] ib.he^3.ba.ca^3.dd.bb^4.hd^2.gc^2.ec.ag^2
#> [3] eb^3.dh.ih^3.gh^2.ge^4.db^2.gd.df^2.ag^3.ib^4
#> [4] ed^2.jd.id^3.aj.hi^3.fg^4.ha^3.ef^3.bb^4.be^4
#> [5] eb.ef^4.de^4.gh^2.dc^4.je.dj^2.he.ca^2.df^3
#> [6] ib.cf^4.ih^2.fb^4.df^4.cb^3.hb^3.bi^2.db.ib^4
#> [7] db.hg^2.gd^2.ie.gh.bg^3.ba^4.dg^3.hi^3.jf^3
#> [8] bd^3.gi^3.gg^2.cg^4.dh^3.jc.ib^2.ge^3.cf^2.ee
#> [9] jg^3.hd^4.df^2.ge.ga.fb^3.ei^2.bi^3.ia^3.id^2
#> [10] gf^4.ij^4.dj^3.hd^2.eh^4.bd^4.fb^2.cb^4.cd^3.ji^3
options(freegroup_symbols=NULL) # NULL is interpreted as letters a-z
rfree(10,4) # back to normal
#> [1] a^2.b.d.c^-1 d^4.b.d c^-1.d^3.a^-1 b^-1.a^-2.c a^-2.d^-2
#> [6] c^4.b b^-4.d^-7.c^-3 a^-2.d^4 d^3.b^3.a^-2 c^-3.a^-1.d^2