Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 654 Bytes

Rtutorial.org

File metadata and controls

28 lines (24 loc) · 654 Bytes

R Tutorial

Start R

Basics in R

  • x <- 1 # assign 1 to x
  • square <- function(x) { x * x } # square x
  • x <- 1 # assign 1 to x
  • square <- function(x) { x * x } # square x
  • square(10) # 100
  • # comment

Vector

  • c(1:10) # vector for 1 to 10
  • 1:10 # vector of 1 to 10
  • c(1:10,1:10) # vector of 1 to 10, 1 to 10
  • x <- c(1:10)
  • x

Random numbers

  • runif - random uniform numbers
  • rnorm - random normals

plots

Scatterplots