Giter Club home page Giter Club logo

repr's Introduction

repr Build Status

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 just emits 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.

repr's People

Contributors

flying-sheep avatar karldw avatar takluyver avatar jankatins avatar abielr avatar lyon-fnal avatar denilsonsa avatar geraudster avatar jimhester avatar randy3k avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.