Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show_code=FALSE has different behavior in knit_boostrap() vs knit_bootstrap_md() [broken here] #20

Closed
lcolladotor opened this issue Aug 30, 2013 · 4 comments

Comments

@lcolladotor
Copy link
Contributor

Hello,

I am getting different output when I use knit_bootstrap() and knit_bootstrap_md() with show_code=FALSE.

The way I have things setup, I use knit_boostrap() when working in Textmate2. Basically, I have a shortcut that runs a short bash script that opens R and runs:

library(knitrBootstrap); knit_bootstrap('$FILE', code_style='Brown Paper', chooser=c('boot', 'code'), show_code=FALSE)

As for RStudio, following the setup instructions, this is my .Rprofile https://gist.github.com/lcolladotor/6393166 I use RStudio when I want to submit the html to RPubs. For example, this is the output http://rpubs.com/lcollado/7904

The problem is that show_code=FALSE is not working, and well, you can't toggle code blocks anymore. This is how the output looks like when using knit_boostrap() directly http://biostat.jhsph.edu/~lcollado/misc/outliers-notInteractive.html

Here is the original Rmd file https://gist.github.com/lcolladotor/6370224

In the end, I think that this is related to the fact that knit_boostrap() uses knitr::knit() Or maybe it's also related to knitr::render_html()

Cheers,
Leo

PS, what are the options for the 'graphics' parameter? I can see that it's used in get_style() but I couldn't figure out the options from looking at the code.

@jimhester
Copy link
Owner

Thanks for pointing out this bug, the problem is that for this release I require the html output hook to be set with rendre_html, so you can fix your rstudio bug by running render_html before knitting. The custom function is run after knitting unfortunately, and the knit function used is hard coded, so there is no easy drop in fix.

If you put render_html in the setup block of your Rmd file it should work in Rstudio though.

I will probably put back in the jQuery to transform the base markdown output to bootstrap, I took it out to simplify the code, but this would be a fairly popular use case I would imagine. Sorry for the bug!

Re: graphics see menu.graphics in ?options or the online help at http://stat.ethz.ch/R-manual/R-devel/library/base/html/options.html

@lcolladotor
Copy link
Contributor Author

Right now, if I use render_html() in the .Rprofile, uploading to RStudio works however the preview of the html in the RStudio doesn't. It is not an issue for my use case since I only use RStudio to upload it to Rpubs but it could be for other users.

For example, this is the regular output from the Rmd default template in RStudio.

screen shot 2013-09-04 at 11 10 34 pm

Using knit_bootstrap instead of knit_boostrap_md results in similar output. The only difference is that a .txt file is created in the working directory.

And thanks for explaining the menu.graphics option.

@lcolladotor
Copy link
Contributor Author

I forgot to say that here is the .Rprofile in more detail https://gist.github.com/lcolladotor/6445586

@lcolladotor
Copy link
Contributor Author

Hm... I had incorrectly interpreted where you suggested to use render_html. While adding it to the Rmd file does solve the code blocks toggling problem, I have a related problem now. Basically, I ran knitrBoostrap with the default RStudio Rmd template and now the pictures won't show (locally or in RPubs).

Check http://rpubs.com/lcollado/8117 and https://gist.github.com/lcolladotor/6445771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants