Keeping an exotic pet in your home! Taming Python to live in RStudio because sometimes the best language is both!
Participants need a laptop with RStudio 1.2 and Anaconda 3 installed.
Please also install the reticulate
package and I recommend the development version from github. Installing packages from github requires first installing the devtools
package from CRAN:
install.packages("devtools")
You should be then able to install reticulate
with:
devtools::install_github("rstudio/reticulate")
You can read more about devtools
here: https://www.r-project.org/nosvn/pandoc/devtools.html
We will also use readxl
and ggplot2
. Please also install them from CRAN.
Download this repository. You can do this with the green Clone or download
button above and selecting Download ZIP.
Extract the files.
Please make a note of where your RStudio and Anaconda3 plugins are located. For example, on my windows machine they are:
C:\Program Files\RStudio\bin\plugins
C:\ProgramData\Anaconda3\Library\plugins
This file should help you discover if you are set up for the tutorial.
Start RStudio, open tester.Rmd and hit the knit button.
If all goes well, you should get this output: tester.html
Did you get this error:
*This application has failed to start because it could not find or load the qt platform plugin "windows" in "" *
Some people seem to get this error but not everyone. I've seen it on some windows machines.
You need to set your QT_PLUGIN_PATH environment variable to where the RStudio and Anaconda3 plugins are located
In windows: Control Panel -> System and Security -> System then
Advanced System settings -> Environment variables
I have set mine to:
C:\Program Files\RStudio\bin\plugins; C:\ProgramData\Anaconda3\Library\plugins
You may need to add a new variable. The order of the paths matters - make sure you have the C:\Program Files\RStudio\bin\plugins
first.
If you can describe, resolve or circumvent this in a better but still minimal way, please get in touch!
A couple of mac users reported an error "No module named pandas"
This solution, given by William Farin, might help. Thank you William!!
Create as Renviron. File in a terminal:
touch $HOME/.Renviron
open $HOME/.Renviron
Include inside the file:
RETICULATE_PYTHON=/anaconda3/bin/python3
Close.
Restart RStudio and you hopefully find the tester can now be knitted.
View the Slides
View the Classification of Audio segments by instrument example
user2019 Tutorial: Taming Python to live in RStudio by Emma Rand is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.