Week 2 Getting Data into R
Dr. Akram Almohalwas
June 28, 2015
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF,
and MS Word documents. For more details on using R Markdown see http:/rmarkdown.rstudio.com.
When

An Introduction to the Interactive Debugging Tools in R
Roger D. Peng
UCLA Department of Statistics
August 28, 2002
1
Introduction
The purpose of this document is to provide a brief introduction to the built-in program
debugging tools in the R statistical

Week 5 The Apply Family, Sampling, and Basic Function
Programming
Repetitive Actions
Stat 20 Summer 2016
July 18 & July 20, 2016
Background
One of Rs strengths is the ability to perform an action repeatedly. We can see this in three areas this week:
1.
2.

Lab 2 - Statistics 20
Ye Rin (Stacey) Lee
June 27, 2016
1. Convert non-R data to R data
A.
Find 3 variables with the most missing
library(foreign)
a1 <- read.spss("http:/www.sjsu.edu/people/carlos.e.garcia/courses/soci104/CourseAssignments/104data_2014.s

Final Review
David Wong
May 29, 2016
Random sampling
#Random sampling
set.seed(12345)
junk <- sample(0:10, 5)
junk
# [1]
7
8
6 10
3
mean(sample(0:101, 25)
# [1] 44
junk2 <- iris[sample(nrow(iris), 15), ] #random sample of size 15 from every col
head(junk2

-title: "Week 4 IrRitations/Necessary Evils"
author: "Ye Rin (Stacey) Lee"
date: "July 24, 2016"
output: html_document
-`cfw_r setup, include=FALSE
knitr:opts_chunk$set(echo = TRUE)
`
# Factors
* variables which take on a limited number of different value

Stats 20 Lab 4
Ye Rin (Stacey) Lee
July 14, 2016
1. Varible Creation and Transformation
A. Comptuting Loan-to-Income Ratio
load(url("http:/www.stat.ucla.edu/~vlew/datasets/loans.RData")
loans$LIR <- (loans$LoanAmount / loans$AppIncome)
head(loans$LIR)
# [

CHEAT SHEET
Ye Rin (Stacey) Lee
July 26, 2016
Week 1: Basic Concepts
1.1 Should Be Automatic
Two Kinds of Vectors
ATOMIC VECTORS:
Simpler of the two.
Contains data of only one type, i.e. all logical values, all numeric values, or all character
values.

Week 1
Stacey Lee
July 19, 2016
Important Panes - Nearly Always Open
Console: Interactive R commands are typed in at the R command prompt. Console pane displays
Rs response.
Source: Issue a FILE-NEW-R SCRIPT at the menu bar, to open a new source window.

-title: "Week 1"
author: "Stacey Lee"
date: "July 19, 2016"
output: html_document
-`cfw_r setup, include=FALSE
knitr:opts_chunk$set(echo = TRUE)
`
# Important Panes - Nearly Always Open
* Console: Interactive R commands are typed in at the R command promp

-title: "Week 2 Review"
author: "Ye Rin (Stacey) Lee"
date: "July 22, 2016"
output: html_document
-`cfw_r setup, include=FALSE
knitr:opts_chunk$set(echo = TRUE)
`
# Saved R Workspaces or R Data Sets
`cfw_r
# A saved R object can be reloaded by using load(

Statistics 20 - Introduction to R
Lecture 9
Jan 25th
2015 Vivian Lew. All Rights Reserved.
The apply family of functions
R has many *apply functions (the asterisk is a placeholder
for this lecture as lots of functions have apply). *apply
functions are loo

Lab 4 - Statistics 20
2015. Vivian Lew. All Rights Reserved.
Due July 20, 2015 before 6pm via upload to CCLE
The only acceptable format for your lab assignments is R Markdown (an .Rmd le) which is created within
RStudio. R Markdown will allow you to combi

Statistics 20
Lab 5 : Due 7/27/2015 before 6pm.
The Data
Package HSAUR2 based on A Handbook of Statistical Analyses Using R (2nd Edition 2010) by Everitt
and Hothorn has a dataset called USmelanoma that we will use. The dataset has the mortality rate due

Week 1 - Statistics 20 - Introduction to R
June 22nd & June 24th
2015 Vivian Lew. All Rights Reserved.
What is R?
R is an expression language with a simple syntax which handles data extremely
well. R is also an environment for statistical computing develo

Lab 2 Assignment
Dr. Akram Almohalwas
July 10, 2015
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word
documents. For more details on using R Markdown see http:/rmarkdown.rstudio.com.
When you click

56
3 Basic Concepts and Data Organisation
3.2.2.5 Factors (factor) and Ordinal Variables (ordered)
In R, character strings can be organized in a more astute way, thanks to the function
factor():
> x <- factor(c("blue","green","blue","red",
+
"blue","green

STAT 20
Week 3
Summer Session A 2015
Discussion Session:
Please download the North Carolina data from ccle.
Call you dataset "data", report its dimension and its srtucture.
First: Run the following code and embed the results at the beginning of your lab r

Lab 4 Assignment
Dr. Akram Almohalwas
July 21, 2015
# Week 5 Lab #4 Assignment:
# The goal of this assignment is to demonstrate your knowledge of linear
regression using R and the ability to find the best predictors that maximizes
R-Squared adjusted. Keep

Week 6 Discussion Activity
Dr. Akram Almohalwas
July 25, 2015
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF,
and MS Word documents. For more details on using R Markdown see http:/rmarkdown.rstudio.com.
When

Homework 5 - Statistics 20
Due Feb 17, 2016 before 11:59 PM via upload to CCLE
For every question below, please display the R commands you use.
Problem 1 (25 pts)
Create a factor
drinks <- factor( c("coke", "coke", "juice", "water") )
(1) (5 pts) Write an

Homework 3 - Statistics 20
Due Jan 27, 2016 before 11:59 PM via upload to CCLE
In this homework we will be using a dataset containing air pollution and temperature data for the city of
Chicago in the U.S. The dataset is provided as an .RData le: chicago.R

Homework 2 - Statistics 20
Due Jan 20, 2016 before 11:59 PM via upload to CCLE
Convert non-R data to R data
Problem 1. (35 pts) For each of the following non-R data les, please (1) convert it into an R data frame,
(2) reveal the dimensions of the converte