• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

binder-examples/r_with_python: Minimal working example for a binder with both R ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

binder-examples/r_with_python

开源软件地址:

https://github.com/binder-examples/r_with_python

开源编程语言:

Jupyter Notebook 99.5%

开源软件介绍:

R + Python Binder Example

This repo builds on the r binder and jupyter lab binder and is complementary to the multi-language-demo binder with examples on using both R and python in both Jupyter Lab and RStudio.

  • Launch in Jupyter Lab: Binder
  • Launch in RStudio: Binder

Example files included:

  • python_example_for_Jupyter.ipynb - Notebook file using a python kernel for working in Jupyter
  • R_example_for_Jupyter.ipynb - Notebook file using an R kernel for working in Jupyter
  • python_example_for_RStudio.Rmd - RMarkdown file with python code chunks for working in RStudio
  • R_example_for_RStudio.Rmd - RMarkdown file with R code chunkcs for working in RStudio

Note: to mix R and python in a single Jupyter notebook, use cell magic as demonstrated in the multi-language-demo binder examples. To mix R and python in a single RMarkdown file (and exchange information between them), make use of reticulate. The latter requires RStudio 1.2+ to work interactively, which is not yet installed as the default binder version (i.e. interactive python and python plots will not yet work in RMarkdown and the above example file uses reticulate for plotting in the knitted file).

Binder Setup

Modify the files in the binder sub-directory to specify required dependencies for R and python. Binder will generate a docker image for your repository after every change to the repo and then will re-use the docker image on subsequent launches. This means that the first time you launch binder for the latest version of your branch, it may take some time to launch (especially with a lot of R dependencies which are all compiled from source) but will be fast for everyone else afterwards. Switching between RStudio vs. Jupyter Lab as the IDE is accomplished easily by changing the binder link as described below - the required dependencies for both are automatically installed and do not need to be explicitly listed in the respective configuration files.

Important: binder will only work for public repositories. If your repository is private, you will have to make it public in the repository settings before you can launch it in binder.

R

  • modify the binder/runtime.txt file to specify which R date snapshot should be used (the MRAN network keeps a daily snapshot)
  • modify the binder/install.R file to make sure all dependencies are specified. Dependencies can be from CRAN, bioconductor or GitHub. Since GitHub hosted libraries are not part of the MRAN snapshot, it is best to specify a commit or release tag to ensure that a compatible version of the package is installed in the binder.

Python

  • modify the binder/environment.yml file to specify the dependencies. The file is a standard conda environment config file and thus supports conda packages, version definitions, multiple source channels as well as pip installations.
  • modify the binder/postBuild file for any JupyterLab extensions or other direct install commands

Binder Link

Jupyter Lab

  • modify the following link to launch your repo in an RStudio binder (USER, REPO, BRANCH): http://mybinder.org/v2/gh/USER/REPO/BRANCH?urlpath=lab
  • modify the following markdown code to create a launch badge like the one at the top this README: [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org/v2/gh/USER/REPO/BRANCH?urlpath=lab)

RStudio

  • modify the following link to launch your repo in an RStudio binder (USER, REPO, BRANCH): http://mybinder.org/v2/gh/USER/REPO/BRANCH?urlpath=rstudio
  • modify the following markdown code to create a launch badge like the one at the top of this README: [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org/v2/gh/USER/REPO/BRANCH?urlpath=rstudio)



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap