knitRBootstrap: zoom options, thumbnail size, and plot size - r

Is it possible to change the default zoom level when using knitRBootstrap?
I know in my knitRbootstrap settings I can change the thumbnail size, but that doesn't allow a lot of flexibility as there is a max value:
knit_bootstrap_md(input=inputFile, output=outputFile, boot_style = 'cerulean',
code_style="Google Code",
chooser=NULL, thumbsize = 9, show_code=FALSE)
I like the features of knitRbootsrap and prefer it over conventional knitR, but not sure the easiest way to customize image size to allow for certain plots/charts to appear larger

The current github version of knitrBootstrap has a chunk option for the image thumbnail size with bootstrap.thumbnail.size. They correspond to the bootstrap grid options, the default is col-md-6.
The new version is not yet available on CRAN, but you can install it easily with devtools.
install.packages('devtools')
library(devtools)
install_github('jimhester/knitrBootstrap')
Please see the knitrBootstrap github page for full details on all the options and using the new version.

Related

rstudio color appearance, specific color for package names, front ::

I'm working with R, in RStudio, and I use to specify the package of each function in my scripts, even if the package is already loaded in the environment. I want to be sure that the code will use the filter() function from dplyr, and not from another package which has a similar named function.
For instance :
Question/ to make code easier to read, is there a way to play with global appearance colors, and that package names (all names before ::) are in a different color (light grey for instance) ?
Here is a complete answer, I guess will work.
Since a recent version of rstudio, you can add custom themes on rstudio (see this update blog)
From this point you can create custom themes, but it require you to know the "code" for each part of your script. After opening the inspector, I've foudn that the dplyr word before the :: is named as support. See the color used in the theme Cobalt here (custom theme editor).
Finally, once you created your own theme by modification of a previous one (creating from scratch is always a pain), you import it in rstudio (see in the first link) and apply it.
At this point you won't see any change, because you also need to check Global options > Code > Diplay > highlight R function call. This will highlight the word classified as support and as support.function. You can set both colors in the theme editor (Cobalt theme has the first one in light green and the second one in light orange).
I've not done the full process myself but I think it could work.
You can modify themes at this website: https://tmtheme-editor.herokuapp.com/#!/editor/local/Monokai
If you go to Customize Preview Code at the bottom right, you can test out the code in your image above.
If you change the color for variable, it seems like this makes the change you're looking for.
When you've customized everything to your liking, you can download your custom theme. Then you can go back to Rstudio --> Tools --> Global Options --> Appearance, and click 'Add' to add your theme.

Leaflet r map saving issue

I have used addlogo to my leaflet map which displays my organizations' logo on the bottom right of the map.
This is logo visible in the viewer within R. However when I save the map the logo is not visible in either a png or HTML format. Please view the code below and the attachments.
Any advice would be appreciated.
Best Wishes
MD
I have used webshot to save as HTML but still the same issue
save the file to png
mapshot(m, file = "myfilepath", remove_controls = NULL)
The output should be saved with the logo at the bottom right hand visible.
Instead of using webshot, you should consider to try webshot2. See my detailed answer to the similar case.
The code:
# Webshot and phantomjs have been previously installed.
library(webshot2)

How to set Atom prettier tab size?

When I disable the prettier-atom package, the tab size is 4, but when I enable the prettier package, formatting a file causes the tab size to decrease to 2. My prettier version is 0.56.4; I was able to directly modify the tab size of prettier in my prettier package settings on a previous version, but now the option is gone. I've looked at other questions about tab size, but haven't found where to directly edit the prettier default tab size.
Any help or direction is appreciated. :)
Unfortunately, the tab length in the latest prettier-atom package is 2 and there is no way to change it.
The atom-beautify package https://atom.io/packages/atom-beautify uses the standard Tab Length from your Atom settings.

How do I apply RStudio themes only to the source and console backgrounds and not to the whole GUI?

I'm using RStudio 1.1.383 and R 3.4.3 and I'm trying to apply a theme under Options > Appearance only to the background text area of the source pane and the console pane. This is exactly what happens when I apply a theme on my desktop computer (Win10), but when I apply a theme on my laptop (also Win10), it applies the theme to the entire GUI except for the top menu bar (i.e. File, Edit, Code, etc). The result looks jarring. Why might themes be behaving differently between my two computers which use identical setups? Is there an option that I might have selected somewhere on one and not the other that would cause the theme to apply to just the text area of a couple panes in one case and the entire GUI in the other?
This is a change in RStudio v1.1 -- now, when a 'dark' editor theme is selected, the entire IDE will be themed to match that.
If you'd prefer to have a dark editor theme with a light IDE theme, that's unfortunately not possible in v1.1. You might want to file a feature request at https://github.com/rstudio/rstudio/issues.

using knitrBootstrap example drop-down styling

In the link below you'll see the current example for cars with a certain drop-down styling. When I produce this same example I get a different style where the drop down boxes extend the width of the content area. Is there something I need to add to my Rmd to use the style on the website instead?
http://rawgit.com/jimhester/knitrBootstrap/master/vignettes/two-D.html
You need to use the github version of the knitrBootstrap package in order to use buttons rather than panels. The CRAN version of the package only has panels. The easiest way to install the package from github is with devtools.
install.packages(devtools)
library(devtools)
install.packages('jimhester/knitrBootstrap')
library(knitrBootstrap)
Also note the github version of knitrBootstrap uses the new rmarkdown package, so you generate the report using the rmarkdown::render function.
The default is collapse type in the new version is buttons, but you can specify using panels to toggle with the chunk option bootstrap.panel.\
See https://github.com/jimhester/knitrBootstrap for more details on using the new package and all the options available.
I unfortunately cannot release the current code to CRAN until the rmarkdown package is also released to CRAN, so in the meantime this is the only way to get the new features.

Resources