140 likes | 249 Views
R freeware statistics package. Tara Jenson NCAR RAL JNT Tom Hopson. What is R?. • A statistical programming language. • In part, developed from the S Programming. Language from Bell Labs (John Chambers). • Created to allow rapid development of. methods for use in different types of data.
E N D
R freeware statistics package Tara Jenson NCAR RAL JNT Tom Hopson
WhatisR? •Astatisticalprogramminglanguage •Inpart,developedfromtheSProgramming LanguagefromBellLabs(JohnChambers) •Createdtoallowrapiddevelopmentof methodsforuseindifferenttypesofdata. •Createnewgraphics.Manydefault parametersarechosen,butusersretain completecontrol.
WhyR? •Rhasbecomethedominantlanguageinthestatistical researchcommunity. •RisOpenSourceandfree. •Runsonalloperatingsystems •Nearly2,400packagescontributed. •Packagesandapplications innearlyeveryfieldof science,businessandeconomics. •SeeRNotes,RJournalandJournalofStatistical Software www.jstatsoft.org •Morethan100bookswithaccompanyingcode •Verylarge,activeuserbase.
WhynotR? •NCL,IDL,Matlab,SAS,…areallviable alternativestoR.Ifyouareapartofanactive communityofresearchersusinganother language,dolikewise. •Ifwewerebiostatisticianswewouldbeusing SAS.BookTitle:“AnalyzingReceiverOperatingCharacteristicCurveswithSAS” •Considerbuildingverificationfunctionsand utilitiesaspartofcodedevelopment. Verificationneednotbeanexternalprocessto forecasting.
TheRCommunity •Developers –RCoreGroup(17members),only2haveleftsince 1997 –MajorupdateinApril/October(freezedates,beta versions,bugtracking,...) •Mailinglists –Helplist~150messages/day,archived, searchable. •5InternationalConferences,2US,1China
EverythingaboutRisatwww.r-project.org •Sourcecode •Binarycompilations(Windows,MacOS,Linux •Documentation(Maindocuments,plusnumerous contributed.Someinforeignlanguages.) •Newsletter(replacedbyRJournal.) •Mailinglist(Severalsearchengines) •Packagesoneverytopicimaginable •Wikiwithexamples •ReferencelistofbooksusingR.(morethan100) •TaskManager
UseRwithscripts •InLinux-EmacsSpeaksStatistics –Provides syntax-based –Objectnamecompletion –Keystrokeshortcuts –Commandhistory –Alt-xRtoinvokeRwithXemacs. •InWindows,useeditor –AddedGUIfeatures –<control>RsendsalineorhighlightedsectionintoR. –InstallpackagewithGUIs –Savegraphicsbypointandclick. •MacOS –SimilartoWindowswithadvantages ofsystemcalls.
PackagesinR •Contributedbypeopleworldwide. •Allowscientistsorstatisticianstopushtheir ideas. •ApplyandextendRcapabilitiestomeetthe needsofspecificcommunities. •Accompanymanystatisticaltextbooks
Asampleofusefulpackages • • • • • •Rgis,spatstat(GIS) •ncdf(supportfor netcdffiles) •Rcolorbrewer •randomForests verification fields(spatialstats) radiosondes extRemes BMA(BayesianModel Averaging) •BMAensemble •circular •Rsqlite
Packages •Packagesmustbeinstalled tocall. •Packagesmustbecalledtouse. •Basepackagesareinstalledbydefault.
10mostusefulfunctioninR •aggregate-appliesafunctiontogroupsof datasubsetbycategories. •apply-incrediblyefficientinavoidingloops. Appliesfunctionsacrossdimensionsofarrays. •layout-creativelydivideaprintregion. •xyplot(inthelatticepackage)slightlyadvance graphictechniques •%in%returnslogicalshowingwhichelements inAareinB.(e.gA%in%B)
Moretop10 • • • • • table–createcontingencytabelcounts. boot–applybootstrapfunctioncorrectly read.fwf–readfixedwidthformatdata par–controleverythinginagraph system()–allowsyoutocallsystem commandfromR •pairs–themostunderutilizedplot–plotsa matrixof4columnsina4x4plotlayout
Login, start your windowing system. $ R Start R as appropriate for your platform. The R program begins, with a banner. (Within R, the prompt on the left hand side will not be shown to avoid confusion.) help.start() Start the HTML interface to on-line help (using a web browser available at your machine). You should briefly explore the features of this facility with the mouse. In particular, work through 1.5, 2.1 – 2.3, and appendix A (just the first one or two sections)
RExercises • • • • • Choosegroupsof3-4–findacomputer Logontomachines Bringupatleast2xterms >cd/home/user/Desktop/longlead >viintro2R.2013.R And work through the commands given …