复旦R语言PPT课件.ppt
《复旦R语言PPT课件.ppt》由会员分享,可在线阅读,更多相关《复旦R语言PPT课件.ppt(51页珍藏版)》请在冰豆网上搜索。
![复旦R语言PPT课件.ppt](https://file1.bdocx.com/fileroot1/2022-10/7/f695ce10-1b46-49e2-8dbe-5eca561aeef0/f695ce10-1b46-49e2-8dbe-5eca561aeef01.gif)
R:
Statistics?
Programme?
andWhoareYou?
-AnABCintroductiontoR,PresentedbyGuohuiDingR&D,SIBS,CAS,ForFudanUniversity,MainTopicsToday,WhatisR?
HowtoadministrateR?
HowdoesRwork?
HowtoapplyRforstatisticalproblem?
HowtoprogramyourRfunction?
WhatisR?
AbriefhistoryofR,ThelegendofR,Rstartedintheearly1990sasaprojectbyRossIhakaandRobertGentlemanattheUniversityofAuckland,NewZealand,intendedtoprovideastatisticalenvironmentintheirteachinglab.ThelabhadMacintoshcomputers,forwhichnosuitablecommercialenvironmentwasavailable.,RobertGentleman,RossIhaka,RsParents
(1),TheSlanguageS:
aninteractiveenvironmentfordataanalysisdevelopedatBellLaboratoriessince1976ExclusivelylicensedbyAT&T/LucenttoInsightfulCorporation,SeattleWA.Productname:
“S-plus”.,Youcanlearnmorefrom:
http:
/cm.bell-,MyfatherisS,motherisScheme,butwhymynameis“R”?
TheSchemelanguageSchemeisastaticallyscopedandproperlytail-recursivedialectoftheLispprogramminglanguageinventedbyGuyLewisSteeleJr.andGeraldJaySussman.Learnmore:
http:
/swiss.csail.mit.edu/projects/scheme/Schemesunderlyingsemantics+Ssyntax=R,RsParents
(2),“WehavenamedourlanguageRinparttoacknowledgetheinfluenceofSandinparttocelebrateourownefforts.”-R.IhakaR.Gentleman,RNow,Sincemid-1997therehasbeenacoregroupwhocanmodifytheRsourcecodeCVSarchive.TheRpackagesystemCRAN(theComprehensiveRArchiveNetwork),http:
/www.r-project.org,ThecharactersofR,Ris“GNUS”Alanguageandenvironmentfordatamanipula-tion,calculationandgraphicaldisplay.ThatisRisaFreeSoftware(orOpensourcesoftware).(Here,Freereferstofreedom,notprice,althoughRisfreeinthatsenseaswell.)ThecoreofRisaninterpretedcomputerlanguage.Amosaicofprocedure-basedprogrammingandobject-orientedprogrammingGoodinterfacetoprocedureswritteninC,C+,FORTRANandotherlanguagesAflexibledataexchangemechanismaccessingrelationaldatabases-ODBC,PostgreSQL,MySQLandsoon.,小偷与强盗的谈判,RandStatistics,Mostpackagesdealwithstatisticsanddataanalysis.Powerfulstatisticalgraphics.Wellcrosstalkingwithotherstatisticalsoftwares.MostRuserarestatisticalexperts.Youcanlearnmoremodernanalysismethodfromtheybyemail.Youcandoitwhenyoucomeacrossathingnobodydoitbefore.,InstallandadministrateR,FocusonWindows(MS),HowdoIgetR?
Theinformationalwebsitehttp:
/www.r-project.org/CRAN-theComprehensiveRArchiveNetwork.Theprimarysiteishttp:
/cran.r-project.org/.Mirrorsitesareavailableformanycountries.CRANsiteshavebinarydistributionsforWindows95,98,ME,NT4,2000andXPonIntel,fortheMacintosh(System8.6to9.1andMacOSX),andforseveralLinuxdistributions.Newreleasesoccurfrequentlyaboutevery3months.Bepreparedtore-installfrequently.Alsoyoucangetitfromyourfriends,teachers,etc.,Downit!
Itisabout20.6Minsize.,UsingPrecompiledBinaryDistributions,InstallingR,Doubleclick“rw1091.exe”usingyourmouse.ThatisOK.YoucaninstallitasallotherstandardMSsoftwares.,RConsole/RGuiinWindows(MS),Commandbox,Graphicsbox,Menu,Icons,SeveralconceptsinAdministratingR,Workspacexxx.RDataHistoryxxx.RhistoryPackageObjectSessionConsole,RunyourRcodes,Load/saveworkspace,Load/saveHistory,Changeyourworkingdirectory,Addanewpackage,Commands:
library()addapackageinthelibrarydetach(package:
xxx)detachapackageAllcandointheGUI(exceptdetach(),Loadalocalpackage,Installpackagesfrominternetorlocal,Updatethelocalpackagefrominternet,PackagesinREnvironment,Basicpackagespackage:
methodspackage:
statspackage:
graphics“package:
utilspackage:
baseRecommandedpackagesgrid;lattice;e1071Contributedpackages(morethan366packagesnowadays),Youcanseewhatpackagesloadednowbythecommandsearch().,Dontloseyourway!
Threeusefulsystemcommandgetwd()GetWorkingDirectorysetwd()SetWorkingDirectorylist.files()ListtheFilesinaDirectory/Folder,ShowtheDemonstrationsofthePackages/Functions,Commandsdemo()DemonstrationsofRFunctionalityexample()RunanExamplesSectionfromtheOnlineHelp,GettingHelps,Severalcommandshelp.start()help()or?
()help.search()apropos()InternetsearchingIlikeitverymuch.Itseemsomnipotence.,QuitR,Commandq()TerminateanRSession,HowdoesRwork?
BasicRStructureanddatamanipulation,BasicRworkingflow(Objectorientation),package,-RforBeginners.EmmanuelParadis,Objectorientation,Object:
acollectionofatomicvariablesand/orotherobjectsthatbelongtogetherParlance:
class:
the“abstract”definitionofitobject:
aconcreteinstancemethod:
otherwordforfunctionslot:
acomponentofanobject,TypesofDatainR,Thebasicdataobjectisavectorofelementsoftype:
numericnumbers-eitherfloatingpointorintegercharactereachelementisacharacterstringlogicaleachelementisTRUEorFALSElistelementscanbeanytypeofobject,includingotherlistsCom