preview.RdIntend to preview files or html page directly into the viewer pane of the RStudio environment (works on unix system).
preview(..., url_path = NULL)
| ... | (`character`) |
|---|---|
| url_path | (`character`) |
The file path provided via `...` has priority over `url_path`. The function is expected to work at least with `.html`, `.pdf`, `.mp4`.
if (FALSE) # Needs an active RStudio session # The input for file path is rather permissive: preview("/opt", "software", "R-3.6.2/doc/manual/R-admin.html") preview("/opt/software/R-3.6.2/doc/manual/R-admin.html") # Works with url: preview(url_path = "https://fcacollin.github.io/Latarnia/portfolio/") # Works with mp4 urls: preview( url_path = paste0( "https://www.ucb.com/_up/ucb_com_stories_media/videos/", "UCB90__Our_history_1080p_25fps_H264-128kbit_AAC.mp4" ) ) # Work with pdf: preview("/opt/software/R-3.6.2/doc/NEWS.pdf") # Should not work if file path points at a directory: testthat::expect_error( preview(getwd()) )