Skip to content

SidhuK/r-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

VSCode Snippets for R and R Markdown

This is a collection of snippets for R and R Markdown. It is a work in progress and I will be adding more as I go.

R Snippets

Snippets included:

  • Loading packages
  • Creating a data frame
  • Creating a vector
  • Create a function
  • Create a for loop
  • Create a while loop
  • Create a if statement
  • Create a if else statement
  • Data frame summary
  • Data frame group summary, summary, arrange
  • ANOVA - one way and two way
  • Chi-Square testing
  • T-Test
  • Shapiro-Wilk test
  • Purr: Map
  • Purr: Map DF
  • GGplot: Basic bar chart
  • GGplot: Basic line chart
  • GGplot: Basic scatter plot
  • GGplot: Basic box plot
  • GGplot: Basic histogram
  • GGSave: Save plot to file
  • Dplyr: Filter
  • Dplyr: Select
  • Dplyr: Mutate
  • Dplyr: Arrange
  • Dplyr: Group by
  • Dplyr: Summarise
  • Dplyr: Join
  • Dplyr: Left Join
  • Dplyr: Right Join
  • Dplyr: Full Join
  • Case when
  • Case when with multiple conditions
  • ReadR: Read CSV
  • ReadR: Read Excel
  • ReadR: Read TSV
  • Set working directory
  • StringR: Extract
  • StringR: Replace
  • StringR: Match
  • StringR: Extract All
  • Create a normal distribution

and a few more.

Most of these have been tested and work as expected, however there could be some bugs and syntax errors, so please let me know if you find any.

Some of these snippets might require tweaking for your specific use case, and a lot of them are just a starting point, so further customization is required.

Tidyverse is used in most of the snippets, so you will need to have the tidyverse package installed and loaded.

You are welcome to contribute to this project. Please fork the repo and submit a pull request. I will review and merge as appropriate.

How to create a snippet: Check out the VSCode documentation on snippets here: https://code.visualstudio.com/docs/editor/userdefinedsnippets

Additionally, the json files in the snippets.json have a brief explanation of how to create a specific snippet.

About

A Collection of snippets for R (RLanguage) for Visual Studio Code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages