Use Rstudio to Clean Data, Make Plot, and Write Report

Jon Duan
Nov. 16 2015

Welcome to UVic ECON Etherpad!

Reproducible Research

UVic ECON etherpad

Rworkshop Material, download Source code

Slide With Chunk

Other options you can add to the tag

http://rmarkdown.rstudio.com/authoring_rcodechunks.html

Option Description
echo = TRUE or FALSE to show or hide code.
eval = TRUE or FALSE to run or skip the code.
warning = TRUE or FALSE to show or hide function warnings.
message = TRUE or FALSE to show or hide function R messages.
results = “hide” will hide results. They will still be executed
fig.height = Height of figure
fig.width = width of figure

R basic

http://ateucher.github.io/rcourse_site/basics.html

  • Introduction to R and RStudio
  • Calculations
  • A note about naming things
  • Functions
    • Specifying arguments
  • Help
  • Navigating your environment
  • Workspace

Data types and structures

Understanding basic data types in R

R has 6 (although we will not discuss the raw class for this workshop) data types.

  • character: "a", "swc"
  • numeric: 2, 15.5
  • integer: 2L (the L tells R to store this as an integer)
  • logical: TRUE, FALSE
  • complex: 1+4i (complex numbers with real and imaginary parts)

Slide With Python

x = 'hello, python world!'
print(x.split(' '))
['hello,', 'python', 'world!']

Slide With c

Rcpp

Error in (function (file = "", code = NULL, env = globalenv(), embeddedR = TRUE,  : 
  Error 1 occurred building shared library.