Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (33 sloc) 1.28 KB
title author date output
Introduction to R and RStudio
Douglas Bates


Web sites

Simple use of R

  • The basic R data structure is a vector. You can create vectors from sequences
str(ss <- 1:10)

or using a repetitive sequence

str(onetwo <- rep(c(0L,1L),5))
str(onestwos <- rep(c(0L,1L),c(5,5)))

More constructors

  • You can sample from various distributions
  • The sampling functions have names that begin with the letter r
  • Common distributions includes Normal (norm), Exponential (exp), Binomial (binom), Poisson (pois)
str(nn <- rnorm(10))
str(nn12 <- rnorm(10,mean=1,sd=2))