Download presentation
Presentation is loading. Please wait.
1
1 Basics of R, Ch 2.6-6 lFunctions lHelp lManaging your Objects lGetting Data into R lGetting Results out of R © Fall 2004 Don Edwards and the University of South Carolina
2
2 2.6 Functions lInput arguments; output a new object (often a list) lRequired and optional arguments lBuilt-in R functions lOutput can depend on the object type lUser-designed functions
3
3 3 Help lhelp, help.search, ? lGenerates extensive help file with several standard headings lSome of most relevant info is hard to find (e.g., plot()) lExamples section is often disappointing
4
4 4 Managing Your Objects lSome of this info is for more sophisticated users lsearch() path lls() lattach(), detach() lattach() and source() are useful for reading files
5
5 4 Managing Your Objects lrm() lCreating a new workspace (.Rdata file) lWorking with R in a specified (non-default) workspace lManaging objects gets complex
6
6 5 Getting Data into R 5.1 Creating Data lc(), seq(), rep() lrnorm(), etc lCreating matrices with matrix()
7
7 5.2 The read.table() Function lStandardized text data form lbrainbod example las.is=T option lMissing values: NA lNo row names--header=T generates default integer row names lNo (column) names--a couple different options
8
8 5.3 The scan() Function lA typical big-data-set setting èThousands of records èMultiple lines per record èVariable-width fields lAdvanced feature lscan() can also be used for the simplest types of data entry
9
9 6. Getting Results Out of R lNot a strong point of R lOutputting matrices, data frames èt(), ncol èround(), signif() lFunctions: fix() lpostscript and pdf commands save graphs and pictures lOther simple methods for saving objects
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.