MyNixOS website logo
Description

Serializable Representations.

String and binary representations of objects for several formats / mime types.

repr [![b-CI]][CI] [![b-CRAN]][CRAN]

String and byte representations for all kinds of R objects.

This package exists to reliably create readable text (and viewable image) representations of data without the side effects print() can cause, such as invoking a pager and plotting to a plot device. In other words, all repr functions and methods are pure.

It is intended to be the basis of several packages that need to create rich text and graphics from R objects, such as Jupyter’s IRkernel, knitr, and others, such as a future more powerful replacement for R CMD Rd2pdf.

Exports

repr is a function delegating to the individual repr_* functions.

repr_*, e.g. repr_text, repr_html, and repr_png emit single-element character vectors or raw vectors. They have parameters also configurable via global options.

mime2repr is a list mapping all known mimetypes to repr_* functions, e.g. mime2repr[['application/pdf']] is repr_pdf.

format2repr does the same for simple format names. So format2repr$markdown is repr_markdown.

Imports

Per default, repr will not use any packages not part of the R distribution.

Only if you want to use repr_html.function and repr_latex.function, and specify the parameter highlight or option repr.function.highlight to be TRUE, then be sure to have highr installed.

Formats

Currently, the actually emitted formats are:

  • Plain text, for everything, using capture.output(print(thing)). This will fail if print(thing) plots it instead. Please report classes which do that and aren’t handled yet (such as recordedplot).

  • HTML, Markdown, and LaTeX, which are emitted for everything non-graphical

  • PNG, JPG, SVG, and PDF for everything graphical (ATM just recordedplot)

Why not Pander?

Pander Is very configurable and does the same as this one, only just for Markdown. Why don’t we use it and use Pandoc to convert to other formats like it?

Because it emits just Markdown, which is the least semantic format available. A roundtrip through Markdown will undoubtedly create sub-par HTML and LaTeX.

Also Pander supports only text. Plots and images are also important to represent.

Pander is however awesome for high-quality Markdown so this project might want to depend on it.

Metadata

Version

1.1.7

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows