{"id":13427028,"url":"https://github.com/binder-examples/r","last_synced_at":"2025-03-15T22:31:41.310Z","repository":{"id":26140115,"uuid":"107462598","full_name":"binder-examples/r","owner":"binder-examples","description":"Using R with Jupyter / RStudio on Binder","archived":false,"fork":false,"pushed_at":"2025-01-21T11:50:36.000Z","size":1651,"stargazers_count":226,"open_issues_count":7,"forks_count":279,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-01-21T12:31:55.488Z","etag":null,"topics":["binder","binder-ready"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binder-examples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-18T21:01:56.000Z","updated_at":"2025-01-21T11:50:41.000Z","dependencies_parsed_at":"2025-01-21T12:36:04.082Z","dependency_job_id":null,"html_url":"https://github.com/binder-examples/r","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binder-examples%2Fr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binder-examples%2Fr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binder-examples%2Fr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binder-examples%2Fr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binder-examples","download_url":"https://codeload.github.com/binder-examples/r/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801601,"owners_count":20350105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binder","binder-ready"],"created_at":"2024-07-31T00:01:51.414Z","updated_at":"2025-03-15T22:31:36.295Z","avatar_url":"https://github.com/binder-examples.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Specifying an R environment with a runtime.txt file\n\nJupyter+R: [![Binder](http://mybinder.org/badge_logo.svg)](http://mybinder.org/v2/gh/binder-examples/r/master?filepath=index.ipynb)\n\nRStudio: [![Binder](http://mybinder.org/badge_logo.svg)](http://mybinder.org/v2/gh/binder-examples/r/master?urlpath=rstudio)\n\nRShiny: [![Binder](http://mybinder.org/badge_logo.svg)](http://mybinder.org/v2/gh/binder-examples/r/master?urlpath=shiny/bus-dashboard/)\n\nBinder supports using R and RStudio, with libraries pinned to a specific\nsnapshot on [packagemanager.rstudio.com](https://packagemanager.rstudio.com/client/#/).\n\n### Requirements and suggestions\n\nYou need to have a `runtime.txt` file that is formatted like:\n\n```\nr-\u003cr-version\u003e-\u003cYYYY\u003e-\u003cMM\u003e-\u003cDD\u003e\n```\n\nwhere `\u003cr-version\u003e` is a version of R (like 4.1, 4.0, etc) you want to use,\nand `\u003cYYYY\u003e-\u003cMM\u003e-\u003cDD\u003e` is the date for [a snapshot](https://packagemanager.rstudio.com/client/#/repos/1/overview)\nfrom [packagemanager.rstudio.com](https://packagemanager.rstudio.com) that will\nbe used for installing your R packages.\n\nTry using a date newer than `2022-01-01`, as you'll get faster\npackage installs thanks to [binary packages](https://www.rstudio.com/blog/package-manager-v1-1-no-interruptions/)\nfrom rstudio.packagemanager.com!\n\nTo install R libraries, add `install.package(\"\u003cpackage-name\u003e\")` calls to\n`install.R`. If you want to pin to a specific version of the library, you\ncan also do `devtools::install_version(\"\u003cpackage-name\u003e\", \"\u003cversion\u003e\")`.\n\nFor some R packages, you might need to install system packages via apt - you can\ndo so by writing out a list of apt package names in `apt.txt`. You can find\nthe list of such packages in the page for your package at\n[packagemanager.rstudio.com](https://packagemanager.rstudio.com/client/#/). Make sure\nto select \"Ubuntu 18.04 (Bionic)\" in the dropdown on the top right.\n\nBoth [RStudio](https://www.rstudio.com/) and [IRKernel](https://irkernel.github.io/)\nare installed by default, so you can use either the Jupyter notebook interface or\nthe RStudio interface.\n\nThis repository also contains an example of a [Shiny app](https://github.com/binder-examples/r/tree/master/bus-dashboard).\n\n## Alternatives\n\nThere are many ways to use R in mybinder.org!\n\n**[rocker/binder](https://github.com/rocker-org/binder/)** - this uses a base image from the R community's\nexcellent [rocker project](https://www.rocker-project.org/) - you get a lot of curated base\npackages, faster binary package installs as well as ability to pin to a specific version of R (\u003e4.0).\n\n**[r-conda](https://github.com/binder-examples/r-conda)** - mybinder.org also\nsupports using the [conda](https://conda.io) package manager to manage R and R packages.\nThis gives you access to specific R versions as well as fast installs of R\npackages available in [conda-forge](https://conda-forge.org/)\n\nAnother alternative is to use the [holepunch package for R](https://karthik.github.io/holepunch/articles/getting_started.html).\n\n### URL addresses for RStudio and Shiny environments\n\nThe Binder repository can be used to allow anyone to access an RStudio environment containing our code and data right\nin their web browser. It also allows hosting a Shiny app. For those purposes, we have to append a bit of text to the\nURL of our Binder repository, which we can find out at [mybinder.org](https://mybinder.org/) when we enter\nthe URL of our original repository from GitHub or Figshare, etc.\n\n- For the RStudio environment, we must add the following at the end of the URL: `?urlpath=rstudio`\n\n  - Example: http://mybinder.org/v2/gh/binder-examples/r/master?urlpath=rstudio\n\n- For the Shiny app environment, we must add the following at the end of the URL: `?urlpath=shiny`. In this case, we\nalso have to note that if the Shiny app files are located in a folder, this folder should be specified in the URL,\nafter a slash. We would then also have to put in a trailing slash at the end of the URL, and to avoid spaces in the\nname of the repository, placing instead a hyphen (the reason is that spaces are converted to `%20`).\n\n  - Example: http://mybinder.org/v2/gh/binder-examples/r/master?urlpath=shiny/bus-dashboard/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinder-examples%2Fr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinder-examples%2Fr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinder-examples%2Fr/lists"}