Simple Lightbox Example in Quarto - lightbox

I've created a minimal example to troubleshoot a problem encountered with the Lightbox extension to Quarto.
The current error is
GET: /lightbox.html
Error running filter _extensions/quarto-ext/lightbox/lightbox.lua:
_extensions/quarto-ext/lightbox/lightbox.lua:113: attempt to call a nil value (field 'is_format')
stack traceback:
(There is nothing listed after "stack traceback".)
I've tried to replicate the "Simple Lightbox Example" from https://github.com/quarto-ext/lightbox.
I get this error when I try to render...
the book's lightbox.qmd through VS Code (using quarto preview, and several variations)
the stand-alone not-in-the-book.qmd through VS Code (using quarto preview, and several variations)
the book's lightbox.qmd through RStudio (using the "Render button)
the stand-alone not-in-the-book.qmd through RStudio (using the "Render button)

Upgrading to this week's version of Quarto (v1.2.269) fixed the problem.

Related

Is it possible to directly embed a Shiny app in a bookdown document?

By "directly" I mean not by uploading the app and then using knitr::include_app, but rather entering the source code of the app itself into the Bookdown document.
Rmarkdown supports this, but neither this approach, nor this seems to work with Bookdown. (The former gives an "Error: path for html_dependency not provided" error, the latter displays an empty frame.)

Rstudio Global Changes: show chunk output in console via CLI?

How can I force RStudio (v1.1.383) to evaluate R chunks always in console (instead of inline) when working with Rmarkdown documents, using a script?
I know I can set up Output chunks in Console by clicking on it:
According to this RStudio support post I could also un-check 'Show output inline for all R Markdown document' under 'Tools -> Global Options...':
But, is there a way to do it from a command line?
The reason I ask is that, I often work on my university machines and they all restore to defaults after each reset. Each time when in class, we have to manually go thru menus.
Knowing how to do it via a console command would as useful as starting each of my classes with
rm(list=ls())
There's not currently an elegant way to do this. This preference is stored inside an internal RStudio state file, in %localappdata%\RStudio-Desktop\monitored\user-settings. If you're sufficiently motivated you can write a script which sets the rmd_chunk_output_inline preference, but it's going to be unpleasant.
One thing you can do is set the chunk output type in the YAML header, like this:
---
editor_options:
chunk_output_type: console
---
You could also use an R Markdown document template with this set up for you (maybe your script could write this out).
Finally, there's an open issue for this on RStudio's github page which you might comment on and/or vote for:
https://github.com/rstudio/rstudio/issues/1607

RStudio snippet not working

I'm utilizing a Macbook pro running "El Capitan" and RStudio is version 0.99.902. I'm writing a Rmd document. I want to utilize the snippets that RStudio has built in and create my own also. By clicking Preference => Code; I can see that "Enable code snippets" is checked. However, while trying to utilize any snippet the completion is not performed. If I typed just r I should get this block of code, but nothing hapen
snippet r
```{r ${1:label}, ${2:options}}
${0}
```
I also create a simple snippet:
snippet dthen
%>%
None of the markdown snippet seems to work. Do I'm doing something wrong or any setting has to be done?
You can invoke code snippets in Markdown in RStudio using Shift+Tab after typing the snippet, but it will not currently prompt you to expand the snippet, either with Tab or by just waiting. I thought this was a bug, but the discussion in this GitHub issue says it's intended, just still-to-be-documented.
In Tools > Global Options > Code > Editing > Edit Snippets, go to the section "Markdown" and paste your snippet there. Save, OK, apply. Type r in your Rmd document (not within in a R code chunk) and click Shift+Tab. If it still does not work, try to create a new "R markdown" file (File > New file > R markdown) and check if it works there.

gvisMotionChart is not working in R markdown file

I need to embed gvisMotionChart into an R markdown file and find an example interactive which is really helpful. However when it comes to the googlevis plotting I keep getting this error when I press the "run code" button:
connection to openCPU failed:
error
undefined
NetworkError: A network error occurred
Can anybody figure out the solutions?
Thanks in advance.
The googleVis package creates the javascript that has to be embedded into an HTML document in order for the interactive plot to run on a webpage. You won't be able to get it to work in the console or in Rstudio for that reason. The only way to know for sure if it's working is to knit it to HTML, and then publish it to Rpubs (or anywhere else online). Once it is online it will work. Depending on your browser settings, you might be able to get it to work by opening the HTML locally, but the browser often blocks the embedded plot when opened locally.
Without seeing your actual code, I can't provide you with anything more specific than that.
EDIT: I thought I would add that several months ago I made a markdown file detailing interactive plots in R for a class. You can find it here: http://rpubs.com/crmhaske/uwloo670_Interactive_Plots
If you scroll down to the very end you'll see the example I did using gvisMotionChart. You have to make sure the place where you print the graph is in it's own chunk, and that results is asis:
```{r results='asis'}
print(p,'chart')
```

How do I get RStudio to publish R-markdown to the rpubs.org site?

According to a response from the RStudio team, the "standard" solution would be to follow the instructions for "Using R Markdown with RStudio", and notice the button on the third screenshot with the "Publish" button. A wonderfully simple solution that I'm quite grateful they have built.
However, the "Publish" button with the nice arrow and picture of the earth doesn't show up in my preview window, no matter how badly I want it to.
I am using RStudio (RStudio.version() 0.96.231) in Mac OS X Lion (10.7), with latest R version and updated markdown and knitr packages. I have an RPubs account, and have followed the RPubs instructions for creating and previewing the html rendered from an R markdown file from within RStudio.
This seems to be related to a post on the RStudio support blog about not-seeing a Publish button.
However, this question is different, as it requires actually getting content up onto RPubs. I have posted an analogous question on the RStudio Support blog.
The Rstudio team already answered how to get graphics embedded in html rendered by RStudio from R Markdown source; especially by pointing me to this extremely useful page explaining the way RStudio renders and packages R Markdown using knitr:
Using RStudio to render R Markdown
Finally, if you haven't heard about R-markdown (I just learned of it),
go here for details about R-markdown.
Confirmed by Josh Paulson at RStudio, this was a bug with RStudio in OS X Lion and not some weird extra set of unstated dependencies or unclear instructions.
Just install v0.96.233 or greater and this should work on Mac OS X Lion (10.7).
Actually, the implementation and instructions are quite straightforward.

Resources