Workflow
Connect an existing RStudio project to GitHub
A nice feature in RStudio is that it seamlessly integrates version control via Git and GitHub. Git is a version control system keeps track of changes to your code. GitHub is an online hosting service that facilitates collaborating on code based projects.
Move an existing GitHub repo to a new one
In the event of having to move one github repository a different repository, due to needing to separate professional and personal accounts, the following commands should complete the task. 1 Disconnect the local repository from GitHub The first step is disconnect the local repository from GitHub.
R Snippets
One of my favorite features in RStudio is the code snippet. This feature allows users to save frequently used templates of code that can be recycled for other uses. For example, if there’s a function or chain of piped commands that one uses frequently, instead of writing these from scratch every time, the code snippet can be used to insert the template that can then be filled in with .
Parallel parameterized quarto documents
Let’s suppose we wanted to create a separate Quarto report for each species in the built-in “iris” dataset in R. The “iris” dataset, contains the length and width measurements of the sepal and petal of various iris species.
Setting up shared renv libraries
In my day to day duties, I work on several projects requiring coding in R. Each project may require a specific set of R packages which opens up the possibility of running into issues with package management.
Count lines of code
Windows Powershell In Windows Powershell, navigate to the directory containing the files to count Use the following command which will count the lines of code in all .R script files found within that directory dir -Recurse *.
Automating R scripts on Windows
Every now then it may be helpful to automate running R scripts. One example would be to generate a weekly Quarto report. Although there is an R package called taskscheduleR that may work in some cases.