R leaflet package inline in IPython Notebook - r

I'm using R in Ipython Notebook with R line and cell magics. All of my R plots print automatically inline except for the R package leaflet which opens in a new browser tab.
I've tried using %capture to capture the output. I've also tried doing different versions of --inline.
In knitr, the map is included inside the file following the code chunk. Any idea on how to get this functionality in ipython notebook using R?
Thanks in advance for any and all help.
Edit:
%%capture only works with strings.

You can display interactive maps inline using rMaps.
There is a demonstration notebook here:
http://nbviewer.ipython.org/github/ipython/front-to-back/blob/master/R_demo.ipynb

Related

Is there a way to collapse output produced in a Jupyter notebook?

I am creating a Jupyter notebook to demo some functions that I have created and the outputs they produce. Is there a way to setup a Jupyter notebook such that any output produced after running a cell appears within an already collapsed cell? My motivation for this is that large output is printed by all of my functions, and I would prefer for the notebook to not become cluttered as I am demoing the functions.
Thank you in advance!

Using code from ipython in Rstudio

I am trying to CLV in R using data from Big Query.
I have found an article describing how to do it, but the guide codes in iPython instead of, which I not familiar with.
(The guide I want to use: https://github.com/googleanalytics/bigquery-export-ipython-notebooks/blob/master/notebooks/customer-base-analysis.ipynb)
My question is:
- Why would you run R code in iPython and not in Rstudio?
- What code do I have to change in order to run the same analysis in Rstudio instead?

How to create Julia notebook in Juno similar to IJulia or R Notebook

Is it possible to create a Julia notebook in Atom/Juno similar to IJulia (Jupyter Notebook) or R Notebook (RStudio IDE)?
What I am looking for is a format that can save the code input together with the calculated ouput and the output printed in the console in one chunk. I also would like to mix in Markdown between code chunks.
The reason for me not wanting to use IJulia is that I don't want to save my Julia code in JSON format. I want it to be as pure as possible.
Have a look at Weave.jl, which promises:
Current features
Noweb, markdown or script syntax for input documents.
Execute code as terminal or "script" chunks.
Capture Plots, Gadfly and PyPlot figures.
Supports LaTex, Pandoc, Github markdown, MultiMarkdown, Asciidoc and
reStructuredText output
Publish markdown directly to html and
pdf using Julia or Pandoc markdown.
Simple caching of results
Convert to and from IJulia notebooks

How to use inline code in markdown in Jupyter with R

How to use inline code in markdown in Jupyter with R?
CODE CELL
n <- 8
MARKDOWN CELL
The Number is {{n}}
What would be the correct syntax in Jupyter Markdown for R? Is it even possible?
In case you haven't done it already, you might want to give the python markdown extension a shot, that adds the markdown inline code functionality for Python to Jupyter notebooks. On their github they claim:
The Python Markdown extension allows displaying output produced by the current kernel in markdown cells. The extension is basically agnostic to the kernel language, however most testing has been done using Python.
Installation instructions are on the github page of the nbextensions. Make sure you'll enable the python markdown extension using a jupyter command or the extension configurator.
Calling variables then should work inside a markdown cell with the {{var-name}} syntax that you've already given (described in the readme of the corresponding github page (linked in the wiki)).
If this doesn't help, you might want to join the discussion of the corresponding issues in the issue trackers for ipython and jupyter.

Syntax highlighting for Python chunks does not work

I'm trying to create notebooks in which I present the same algorithm written in R and Python. I can easily integrate the R and Python code in a Rmd file and then create a HTML output using the 'Knit HTML' button in RStudio. However the Python code is always displayed without syntax highlighting (not like in the example at https://github.com/yihui/knitr-examples/blob/master/023-engine-python.md). I have Andre Simon's highlight software installed and functioning on my computer (MacBook Pro Retina, MacOS X 10.9).
Currently, I have the following libraries installed in R: markdown 0.6.4, knitr 1.5.15, highr 0.3.1.
Any idea what could be the problem? Thanks for your help!.
That is specific to the RStudio Markdown render, which did not enable syntax highlighting for code blocks that are not R or C++. RStudio uses highlight.js, and you can use your own version of highlight.js to highlight Python code. Or use other Markdown converters such as Pandoc.

Resources