Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basics of R, Ch 2.6-6  Functions  Help  Managing your Objects  Getting Data into R  Getting Results out of R 1 © Fall 2004 Don Edwards and the University.

Similar presentations


Presentation on theme: "Basics of R, Ch 2.6-6  Functions  Help  Managing your Objects  Getting Data into R  Getting Results out of R 1 © Fall 2004 Don Edwards and the University."— Presentation transcript:

1 Basics of R, Ch  Functions  Help  Managing your Objects  Getting Data into R  Getting Results out of R 1 © Fall 2004 Don Edwards and the University of South Carolina

2 2.6 Functions  Input arguments; output a new object (often a list)  Required and optional arguments  Built-in R functions ➞ Output can depend on the object type  User-designed functions 2

3 3 Help  help, help.search, ?, ??,apropos  Generates extensive help file with several standard headings  Some of most relevant info is hard to find (e.g., plot())  Examples section is often disappointing 3

4 4 Managing Your Objects  Some of this info is for more sophisticated users  search() path  ls()  attach(), detach()  attach() and source() are useful for reading files 4

5 4 Managing Your Objects  rm()  Saving a workspace (.Rdata file)  Working with R in a specified (non- default) workspace  Managing objects gets complex 5

6 5 Getting Data into R 5.1 Creating Data  c(), seq(), rep()  rnorm(), etc  Creating matrices with matrix() 6

7 5.2 The read.table() Function  Standardized text data form  brainbod example  as.is=T option  Missing values: NA 7

8 5.2 The read.table() Function  No row names--header=T generates default integer row names  No (column) names--a couple different options  read.delim() and other variations appear to be more robust 8

9 5.3 The scan() Function  A typical big-data-set setting è Thousands of records è Multiple lines per record è Variable-width fields  Advanced feature  scan() can also be used for the simplest types of data entry 9

10 6. Getting Results Out of R  Not a strong point of R  Outputting matrices, data frames è t(), ncol è Recent improvements è round(), signif()  Functions: fix()  postscript and pdf commands save graphs and pictures  Other simple methods for saving objects 10


Download ppt "Basics of R, Ch 2.6-6  Functions  Help  Managing your Objects  Getting Data into R  Getting Results out of R 1 © Fall 2004 Don Edwards and the University."

Similar presentations


Ads by Google