Presentation is loading. Please wait.

Presentation is loading. Please wait.

Statistics 540 Computing in Statistics

Similar presentations


Presentation on theme: "Statistics 540 Computing in Statistics"— Presentation transcript:

1 Statistics 540 Computing in Statistics
© Fall 2004 Don Edwards and the University of South Carolina

2 Course Goals Syllabus R (=Splus) programming
SAS programming (DATA step) Syllabus Read it carefully!

3 Syllabus Read it carefully

4 A Typical Class Review previous coding exercise (10-20 min)
Coding discussion and demonstration (40 min) Assign coding exercise Part of the time spent on exercises is “built in” to class time

5 Learning R Don Edward’s notes Supplemental exercises
Many other R resources available online

6 Basics of R, Chapters 1-2.5 Intro to R Objects, Modes, Assignments
Getting Help

7 1. R: An Introduction Shareware version of S (Splus)
Version (I have ) for Windows; (I have 3.2.4) for Mac Steep learning curve (case sensitive, cryptic help and error messages, data import and export) Download R yourself

8 1. R: An Introduction (cont)
Starting and quitting Object oriented Vectors, factors, matrices, data frames, lists, functions R object names are flexible Be careful of built-in R names Don’t let objects accumulate Objects organized by types; types have common attributes and common treatment by functions.

9 2.1 Vectors Strings of data elements of the same mode
Major modes: numeric, character, logical Examples from R data sets

10 2.1 Vectors (cont) Component extraction
Assignments (beware copying over variables!) Object attributes (e.g. names) length(), c(), “:”, seq() functions No shorthand for increments in “:” statement Functions can be nested Component extraction is an odd name for this function. No warning if copying over! Discuss <- , = and _

11 2.2 Factors Defines groups in data (looks like a character vector, but no quotes) Levels Coercing to a character vector Other coercion functions The similarity to character vectors causes problems if you’re not wary. Factors are very useful in analysis.

12 2.3 Matrices Two-dimensional array; columns have same mode (usually numeric or logical) Attributes: dim and dimnames Caution about length() Extracting a single element, or an entire row or column

13 2.4 Data Frames R’s standard “data set”
Two-dimensional array, but columns may have different modes Attributes: names, row.names Referencing columns with $ Conversion of character vectors to factor objects by data.frame() A data frame is also a list, to be discussed next.

14 2.5 Lists Glued-together strings of diverse objects
Output of many R functions E.g., attributes of any object Extraction with [[ ]] Extraction with $


Download ppt "Statistics 540 Computing in Statistics"

Similar presentations


Ads by Google