Git Product home page Git Product logo

concise-r's Introduction

A Concise Introduction to R

The goal of this material is to provide a concise introduction to R & RStudio with sufficient training on fundamentals that students can understand R syntax, resolve common R errors, and complete basic data analysis. No prior knowledge of R is assumed, nor other programming experience. Each session is intended to take about 3 hours. After completion students should be familiar with R and able to teach themselves more advanced techniques using online resources.

Prepared for Public Policy 290 "Analytics for Government Policy" by Avi Feller, Spring 2016.

Day 1

R Markdown file. Topics covered:

  • Overview of RStudio and RMarkdown
  • Math functions
  • Assignment operator <- and =
  • Importing data: getwd(), rio import()
  • Environmental variables: ls() and rm()
  • Sequences: colon operator : and seq()
  • Vectors, vector functions length(), sum(), mean(), max(), min(), summary()
  • Random numbers: set.seed() and runif()
  • Getting help: ?, help(), help(package=)
  • Calling functions
  • Creating vectors: c(), rep()
  • Subsetting vectors with bracket notation []
  • Data frames: data.frame(), nrow(), ncol(), dim(), names(), str()
  • Subsetting data frames: bracket notation [], $, subset()
  • Factors: levels(), as.character()
  • Object types: class(), str()
  • Data analysis: table(), prop.table()
  • Visualization: qplot() from ggplot2.

Day 2

R Markdown file. Topics covered:

  • Missing values: is.na(), na.rm option
  • More data frames: cbind(), rbind(), colMeans(), rowMeans()
  • More ggplot2: custom labeling, themes, colors, sizes; ggplot(), geom_point(), geom_density(), geom_path(), geom_line(), ggtitle(), geom_text(), geom_label(), labs(), ggsave()
  • Flow control: for loops, if else blocks
  • More vectors: ifelse(), %in%
  • Cleaner text output with cat()
  • Creating functions: basic functions, function arguments, returning results, argument defaults

Future content: day 3 would focus on data analysis using regression, apply and replicate, and merging files.

Resources

concise-r's People

Contributors

ck37 avatar

Stargazers

 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.