"contents": "\r\nThe usethis\r\npackage and the RStudio IDE will help you orchestrate your version\r\ncontrol repositories as RStudio projects.\r\n\r\n\r\n\r\n\r\n\r\nSetup\r\nTo get started, make a free GitHub.com account. Make sure you have\r\nthe latest versions of R, RStudio, and usethis. Then, setup your RStudio\r\nconfiguration using two key documents: Setup,\r\nand Managing\r\nGit(Hub) Credentials.\r\nTips\r\nClone or fork from GitHub\r\n\r\n\r\nusethis::create_from_github(\"https://github.com/data-and-visualization/git-tutorial\")\r\n\r\n\r\n\r\nCreate the GitHub repo from\r\nlocal\r\n\r\n\r\nlibrary(usethis)\r\nuse_git() # initialize a git repo\r\nuse_git_ignore()\r\nuse_readme.Rmd()\r\nuse_ccby_license()\r\n# Before next step → stage & commit changes\r\nuse_github() # Connect local repo to GitHub\r\n\r\n\r\n\r\nRename default branch\r\n\r\n\r\nlibrary(usethis)\r\ngit_default_branch()\r\ngit_default_branch_rename()\r\ngit_default_branch_rediscover()\r\n\r\n\r\n\r\nset-up git and manage\r\nGitHub credentials\r\n\r\n\r\n# Sign-in to your GitHub account\r\n# Read: https://usethis.r-lib.org/articles/articles/git-credentials.html\r\n# Read: https://usethis.r-lib.org/articles/articles/usethis-setup.html\r\nusethis::create_github_token()\r\ngitcreds::gitcreds_set()\r\ngh::gh_whoami()\r\nusethis::git_sitrep()\r\nusethis::use_git_config(user.name = \"Jane Doe\", user.email = \"jane@example.com\")\r\nusethis::git_sitrep()\r\n\r\n\r\n\r\nNext Level…\r\nTake your reproducibility to the next level. Make your code\r\ncitable by connecting your GitHub repo and your ORCID (unique author ID) through\r\nto the Zenodo archival repository.\r\nNow, every time you commit a milestone release, you also mint a DOI.\r\nShare a zero-install\r\ncompute environment\r\n\r\nPublish your code in a binder.org container\r\n\r\n\r\n\r\n\r\n\r\n\r\nEverything you need is exemplified in binder-example for R that you\r\ncan find on\r\ngithub\r\nThe key elements are an install.R and\r\nruntime.txt files. The content and format of each file is\r\ndemonstrated properly at the GitHub repo. Browse and you will see.\r\nStep 1\r\n\r\n\r\n\r\nCreate an install.R file and store it in the RStudio\r\nProject’s root directory. Follow the example at https://github.com/binder-examples/r \r\n\r\nThis file should consist of install functions for each package used\r\nin your R code. If you’re not sure what packages you’re using, try\r\nrunning holepunch::write_compendium_description() and you\r\nwill find the details listed in the DESCRIPTION file under the ‘Depends’\r\nand ‘Remotes’ sections. IMPORTANT: Delete the\r\nDESCRIPTION file Before launching the binder build. In my\r\nexperience the DESCRIPTION file will conflict with the binder’s build\r\nprocess. For non-CRAN packages – specifically packages installed\r\nfrom GitHub – I recommend using the format:\r\nremotes::install_github(\"gadenbuie/countdown\") for each\r\npackage that is not on CRAN. CRAN packages can follow the format:\r\ninstall.packages(\"dplyr\")\r\n\r\nCreate a runtime.txt file and store it in the RStudio\r\nProject’s root directory Follow the example at https://github.com/binder-examples/r \r\n\r\nNote: If you try using holepunch, it will store these\r\nfiles in a .binder subdirectory. In my experience this will\r\ncause the binder build to fail. For this reason, I don’t recommend using\r\nholepunch and I do recommend storing the two files in the project’s root\r\ndirectory.\r\n\r\nStep 2\r\nGenerate a binder badge with\r\nusethis::use_binder_badge(urlpath = \"rstudio\"). This should\r\nstore the badge in your GitHub’s project README file. Then\r\ncommit and push your changes to GitHub; go to\r\nthe README on GitHub, launch the build and wait for the long\r\nlaunch/build time.\r\nHint: be prepared to wait. The first build can take some time.\r\nSometimes you must launch an initial or dormant build more than once. In\r\nmy experienced these hiccups are rare, but try the launch twice before\r\ngetting involved in extensive troubleshooting.\r\n\r\n\r\n\r\nThe old documentation from this site can be found in the v.0.2019\r\nrelease on GitHub.\r\n\r\n\r\n\r\n",
0 commit comments