[R-pkg-devel] Interplay between knitr() and View()

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Apr 20 08:56:33 CEST 2017

I think that exactly what View() shows will depend on your operating
system. On my Linux box, I get a very plain spreadsheet with
everything in fixed-width font, thin black boxes, and a highlighted
cursor box. Numbers are left-justified. There's no scroll bars.

I don't know if it looks the same in Mac or Windows, or if there are
slight differences because the widget sets are different. Would it
matter to your vignette if it was?

What are you using to make your vignette? knitr? If its flexible
enough you could just style a table to look very much like what I see
when I run View, and tell the reader this is an approximation. I don't
know if markdown source is flexible enough to control the visual
appearance of a table, but you could do this in LaTeX with knitr.

You *could* possibly do a screengrab of a live View window, but if you
have to run your vignette on a headless server that means running a
display server screen to do the grab from.

I'd go with styling a good-looking fake table.


On Wed, Apr 19, 2017 at 6:20 PM, Roy Mendelssohn - NOAA Federal
<roy.mendelssohn at noaa.gov> wrote:
> Hi All:
> My package allows the user to search for information about the data available, and the information is returned in a dataframe. I had long been looking for a nice way to display the results  (the datasets' metadata),  and wasn't too happy with anything until I tried the View() command,  which does exactly what I want.
> The problem is I can't seem to find a way to make View() and knitr() work nice together in creating the vignette. Given the way View() works I doubt there is a way,  but any suggestions of how I can show what the user will see when the given the command in the package from within my vignette?
> Thanks,
> -Roy
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list