Coder Social home page Coder Social logo

sidhuk / r-snippets Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 0.0 12 KB

A Collection of snippets for R (RLanguage) for Visual Studio Code. They will also work with the new IDE, Positron.

License: Other

JSON 100.00%
json r rlang rlanguage vscode vscode-snippets

r-snippets's Introduction

VSCode Snippets for R and R Markdown

Just as a quick FYI these should also work for the new RStudio codium based IDE, Positron

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.

r-snippets's People

Contributors

sidhuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.