R-Studio and Revolution Analytics have built additional functionality on top of base R.

Slides:



Advertisements
Similar presentations
Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
Advertisements

R for Macroecology Aarhus University, Spring 2011.
Spreadsheet Software lesson 14. This lesson includes the following sections: Spreadsheet Programs and Their Uses The Spreadsheet's Interface Entering.
VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
Using Excel Biostatistics 212 Lecture 4. Housekeeping Questions about Lab 3? –replace vs. recode Final Project Dataset! –“Housekeeping” commands vs. data.
Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s.
Objective: Dealing with data in C++ Agenda: Notes Essay Help.
Excel Chapter 6 Review slides. How many worksheets are in a workbook, by default? three.
Intro to R Stephanie Lee Dept of Sociology, CSSCR University of Washington September 2009.
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
Databases Ms. Scales. What is a Database? Database  A collection of data organized for fast search and retrieval  Examples: Telephone Directories Hospital.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.
Correlation and Covariance. Overview Continuous Categorical Histogram Scatter Boxplot Predictor Variable (X-Axis) Height Outcome, Dependent Variable (Y-Axis)
Correlation and Covariance
AGB 260: Agribusiness Information Technology Advanced Functions and Logic.
Coding for Excel Analysis Optional Exercise Map Your Hazards! Module, Unit 2 Map Your Hazards! Combining Natural Hazards with Societal Issues.
ALEXANDER C. LOPILATO R: Because the names of other stat programs don’t make sense so why should this one?
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
The Original and Current Basic R “Console” command line interface….
Introduction to to R Emily Kalah Gade University of Washington Credit to Kristin Siebel for development of much of this PowerPoint.
Programming in R Getting data into R. Importing data into R In this session we will learn: Some basic R commands How to enter data directly into R How.
Outline Class Intros – What are your goals? – What types of problems? datasets? Overview of Course Example Research Project.
Data Objects in R Vector1 dimensionAll elements have the same data types Data types: numeric, character logic, factor Matrix2 dimensions Array2 or more.
Introduction to Scheme Lectures on The Scheme Programming Language, 2 nd Ed. R. Kent Dybvig.
Outline Class Intros Overview of Course Example Research Project.
R Programming Yang, Yufei. Normal distribution.
Using Excel Biostatistics 212 Lecture 4. Housekeeping Questions about Lab 3? –replace vs. recode –Cross-checking/recoding missing values –Analysis of.
Outline Comparison of Excel and R R Coding Example – RStudio Environment – Getting Help – Enter Data – Calculate Mean – Basic Plots – Save a Coding Script.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
A Simple Guide to Using SPSS ( Statistical Package for the Social Sciences) for Windows.
R Introduction, Data Structures. An Excellent R Book (among many others) R in Action Data Analysis and Graphics with R Robert I. Kabacoff
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.

Data types S S T : S P R E A D S H E E T S SST 2 Spreadsheet 2 Data Types Name: ______________________ Class: ______________________.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
Learn R Toolkit D Kelly O'DayExcel & R WorldsMod 2 - Excel & R Worlds: 1 Module 2 Moving Between Excel & R Worlds Do See & HearRead Learning PowerPoint.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
1 An Introduction to R © 2009 Dan Nettleton. 2 Preliminaries Throughout these slides, red text indicates text that is typed at the R prompt or text that.
R objects  All R entities exist as objects  They can all be operated on as data  We will cover:  Vectors  Factors  Lists  Data frames  Tables 
Querying Databases A query is a program that allows us to VIEW the data or operate on the data Several types of queries –Select query –Merge query –Summary.

1 PEER Session 02/04/15. 2  Multiple good data management software options exist – quantitative (e.g., SPSS), qualitative (e.g, atlas.ti), mixed (e.g.,
Data & Graphing vectors data frames importing data contingency tables barplots 18 September 2014 Sherubtse Training.
Actor Heights 1)Create Vectors of Actor Names, Heights, Date of Birth, Gender 2) Combine the 4 Vectors into a DataFrame.
Basics in R part 2. Variable types in R Common variable types: Numeric - numeric value: 3, 5.9, Logical - logical value: TRUE or FALSE (1 or 0)
Analyzing Data. Learning Objectives You will learn to: – Import from excel – Add, move, recode, label, and compute variables – Perform descriptive analyses.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
16BIT IITR Data Collection Module If you have not already done so, download and install R from download.
Vectors and DataFrames. Character Vector: b
Working with data in R 2 Fish 552: Lecture 3. Recommended Reading An Introduction to R (R Development Core Team) –
Introduction to R and Data Science Tools in the Microsoft Stack Jamey Johnston.
GCSE COMPUTER SCIENCE Practical Programming using Python
Introduction to R user-friendly and absolutely free
var variableName:datatype;
Introduction to SPSS SOCI 301 Lab session.
Sections Text Mining Plan Twitter API twitteR package
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Advanced Genomics - Bioinformatics Workshop
Uploading and handling databases
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Python I/O.
Code is on the Website Outline Comparison of Excel and R
Data Analytics (CS40003) Programming with R Lecture #4
Vectors and DataFrames
JavaScript.
MIS2502: Data Analytics Introduction to R and RStudio
R Course 1st Lecture.
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Presentation transcript:

R-Studio and Revolution Analytics have built additional functionality on top of base R.

Revolution Analytics has moved onto the radar screen for predictive analytics

Enter Commands View Results Write Code/ Program -Input Data -Analyze -Graphics Datasets, etc.

Character Vector: b <- c("one","two","three") numeric vector character vector Numeric Vector: a <- c(1,2,5.3,6,-2,4) Matrix: y<-matrix(1:20, nrow=5,ncol=4) Dataframe: d <- c(1,2,3,4) e <- c("red", "white", "red", NA) f <- c(TRUE,TRUE,TRUE,FALSE) mydata <- data.frame(d,e,f) names(mydata) <- c("ID","Color","Passed") List: w <- list(name="Fred", age=5.3) Data Structures Framework Source: Hadley Wickham

Actor Heights 1)Create Vectors of Actor Names, Heights, Date of Birth, Gender 2) Combine the 4 Vectors into a DataFrame

Numeric: e.g. heights String: e.g. names Dates: “ Factor: e.g. gender Boolean: TRUE, FALSE Variable Types

We use the c() function and list all values in quotations so that R knows that it is string data. ?c  Combine Values into a Vector or List Creating a Character / String Vector

Create a variable (aka object) called ActorNames: ActorNames <- c(“John", “Meryl”, “Jennifer", “Andre") Creating a Character / String Vector

Class, Length, Index class(ActorNames) length(ActorNames) ActorNames[2]

Create a variable called ActorHeights (inches): ActorHeights <- c(77, 66, 70, 90) Creating a Numeric Vector / Variable

Use the as.Date() function: ActorDoB <-as.Date(c(" ", " ", " ", " “ )) Each date has been entered as a text string (in quotations) in the appropriate format (yyyy-mm-dd). By enclosing these data in the as.Date() function, these strings are converted to date objects. Creating a Date Variable

Use the factor() function: ActorGender <- c(“male", “female", “female", “male“ ) class(ActorGender) ActorGender <- factor(ActorGender) Creating a Categorical / Factor Variable

Actor.DF <- data.frame(Name=ActorNames, Height=ActorHeights, BirthDate = ActorDob, Gender=ActorGender) Vectors and DataFrames dim(Actor.DF)

1234 Actor.DF[4,3] # row 1, column 3 Actor.DF[1,3] # row 4, column 3 Actor.DF[1,] # row 1 Actor.DF[2:3,] # rows 2,3, all columns # column 2 Actor.DF[,2] Accessing Rows and Columns

> getwd() [1] "C:/Users/johnp_000/Documents" > setwd() getwd() setwd()

write.table(Actors.DF, “ActorData.txt", sep="\t", row.names = TRUE) write.csv(Actors.DF, “ActorData.csv") Write / Create a File

Add New Variable: Height -> Feet, Inches Actor.DF$Feet <- floor(Actor.DF$Height/12) Actor.DF$Inches <- Actor.DF$Height - (Actor.DF$Feet *12)

Sort Actor.DF[with(Actor.DF, order(-Height)), ]

Logical Operators / Filter Actor.DF$Height > 68 Actor.DF$Gender == "female" ?'[' Actor.DF[Actor.DF$Gender == "female",]