Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore Cheatsheets_2019

Cheatsheets_2019

Published by ORAUD OFFICIEL, 2020-04-08 19:37:33

Description: Cheatsheets_2019

Search

Read the Text Version

rstudio::conf 2019 / CHEATSHEETS

RRRSSStttuuudddiiiooo IIIDDDEEE ::: ::: CCCCHHHHEEEEAAAATTTTSSSSHHHHEEEEEEEETTTT DDDDooooccccuuuummmmeeeennnnttttssssaaaannnnddddAAAAppppppppssss WWWWrrrriittiitteeeeCCCCooooddddeeee RRRRSSSSuuuuppppppppoooorrrrtttt PPPPrrrrooooFFFFeeeeaaaattttuuuurrrreeeesssswwSShhwwSSiittaahhhiittrraahhCCeerrooCCeePPlloollrrPPaalloollbbrraajjooooeebbjjrrccooeeaattrrccttaaoottttrroossrrss ccAAooccccAAttlloocclliiaavvttllllbbeeiiaavvoobbeessrrhhoossaaaarrhhttaarrooaaeettrrrooddsseerrddss kakOaOnnnnppOakOakiiddnnneettpprriinnddmm,,eettrrSSnnSSmm,,oowwSShhSSrrooeewweeiihhnnrraaeeiieiiyynnnnvvaa,,iieeyynnRRSSvv,,,eeooRRSSLLMM,,uuaaooLLMMaarrTTuuaaccrreeaakkrrTTeeXXccrrddeekkeePP,,XXoodd..aaPPRR,,wwoonn..aaddRRwwnneennddff,,nneeiillff,,eeiillsseess iiSSnnttiSiSaannccttrruuaattccrrruunnrrtteerreennrrnnwweeRSSRpCpSSCeettnneerreewwllRSRSCSCSppooVVooRRttppsslleerreellsseeeejjssooVVoorrRReeppssSSlleeiioorrccsseeeoojjsccrreesseettSSjjeeRRiioorrttccnneeiioosscceessoottjjccRRssttnneeiiiissttnnnniiooccssooiittnnnniinnoonn CssCpphhsCCseeppeehhllcceelleeiikkllnncclliiggkknngg RoRoeeuuoRoRnntteeuuppddnnttuuppeeddttrruueettrr ooCfCfoouuhhfCCoforroottoommuuhhpprroottoommaauuppssootttteeaauusstttee llCooCoouuhhCoollCccoottoouuaahhppccootttooaauuiippssooootttteeuuiinnssootteenn cccIcInnoohhccIcIssnndduuoohheessnneedduurreettkknneerrttkk tNNtaaaaNttNbbaavvaassbbiiggvvssiiaaggttaaeettee wOwOppOOwwiinneeppiiddnnnneeooddnniiwwnnooiiwwnnneennwweeww SSaaSSvvaaeevveeFFrreeiirFFrnnppeeiiddllnnppaaddaallccaanneeaaccddnneedd nCnCooooCCnnttmmoooeettmmbbppeeooiibbppllooeeooiillkkooeeaasskkaass RccRsseeoouuRRccssllddeennooeuueellccddnneetteecceettddeedd wwIImmIwIwiittmmpphhiittoopphhwwrroowwiittzzrraaddiittzzrraaaaddddttrraaddaattaa rHHcrcuuooiiccHrrHnnssmmuuoottii//nnssoommccmmtt//rrooooccyymmaapprroooonnyyyyaappffddoonnyyppssffddaappttssoossaattttoosstt RRFDFDiiiiDFRRFDllPPsseeiippiirrllPPsseelle>>ppaarrssllee>>yyNNaaeess..yyeeNNnnRReeww..tteePPnnRRaawwrrttPPtteeaaFFiirrssoottiieeFFlliisssnneeooiilllliissnnee>>ddlliiee>>ddsseehhssoohhwwoowwss ss T TH HJ J T TH HJ J T TH HJ J T TH HJ J JJcpcphhuurrJpcJpceeuummhhuurrvvnneeuummiippoovvkknniippuuttookkoossuuttoosscJctJtoohhuutJccJtoouummnnhhuunneeuummnnppkkxxnneettppkkxxtt lRlssRiieennuussRlRllliieeennennuussllcceenneettsscceettddeedd tPPtoouuPPttoossbbuueellssbbiirrsseevvllhhiirreessvvhhrreerrSoSohhuuooSSootthhuullwwiioottnnllwwiieeffnniilleeffeeiillee CsCshhuussCCaahhrruussrraaeerroossrrddrreeoossdduurroossssuuffeeoossrrffeessrrss RpRpeerrppRRee--eerrrrvveeuu--iirroovvnnuuiiuuoonnssuuccssooccddooeeddee wSwSoowSwSiittuuoohhiittrruuoocchhrruueeooccttuueewwEEttwwiiccttEEhhhhiiccttoohhhoooorroorr SooShhuuoSSoootthhuullwwiioottnnllwwiieeffnniilleeffeeiillee wwLLooLwwLooaaoorrooddkkaarrssddkkppssaappccaaeeccee wSwSaaSSwwoovvaarrooeekkvvrrsseekkppssaappccaaeeccee sDsDaaeeDsDsvvaalleeeevvllttddeeeeettddooeeaabboollaalljjbbeelllljjcceettccssttss eSeSnneeeSeSaavvnneeiirraarrvvccooiirrhhrrccnnoohhiimmnnnniimmssnneeiinnddsseeiitteennddttee wpydpdwRyRooSSriirpwdRdypwyRoorroouuPPtteeooSSiirrrruuoojjrrookkcceeuuPPttrrRReeFFddrrsstteeuujjcckkcceeooiirrRRppiiOOFF--ttddlloosstteeccoorr..eeaaooiippiiOO--yyttJJllIIooppssccoorrtt..eeaa>>aaEEaayyeeJJeeIIpprrsscctt>>vvssNN,,eennaaCCEEaaeeeerreessaallvvsseeNN,,eennooaaooCCTTssnneessaallwwaacceeooaaddppottTTssnnSSddhhiiwwaarrccaaddppttPPwwssooeeYYSSddhhiittrraarreePPjjwwooeessooeeSSccYYeeoottddaarrrraaeejjoocceeTTSSccjjkkeeooccllddeettwwaarraalliiccTTEEhh..jjkknnccccllhheettwwiilliittttMMggEEhh..wwnniicchhhhssiittttMMggwwhhttiihhaassooeehhttrraaoonneeyyrr,,nnyy,, HAAHccAAHHeeccllcceeeeppccllsseepp>>ssssmm>>ssMMmmMMaaaarrrraaakkkkrrrrddkkddkkooddooddwwoowwoowwnnwwnnnnggnnQQuuggiiQQuuuddiiiuueeddcciikkeeaaccttkkaaRRtteeRRffeeeeffrreeeerrnneeccnneeccee CHCHwMMwooooHHCCwMwMiiuuttddvvooohhlliiuutteeeettddvviihhllAArrpptteeeddiioollllAArrppiieettddaavvoolll++iieecceettggaavvuurrnn++mmcceeggrrddoouurrnnssmmooiissrrddooooaattssuuooiissrriiggooaaccssttssuunnrriiggss//eeccssccoossTofSTfaoSannttuuss//ooeeaaddrrssyynnhhccooaSaToSTffonnggtttlluubbnnrrooaaaadduurrssyyiinnhhyuuccaaccnnggttttttllbbnnccmmoorraattaammuuiiyygguuccaassaaiiccoottttuuxxooccmmoottaa..yymmnnppggeemmaassiirroonnhhuummxxooppnn..yynnppssffeemmiirrppnnhhiinmmeeggeettbbppnnllssssfflleeiiaaaallhhppiinneeooeeggeett,,ebbll''rmrmsslllleessttaaaaallhhllcciieeoo,,eeiissiigg''oonnrmrmtteellnnsstteeaallcciiiihhffiissiiggxxnnddoossoooonntteenntteettttiihh,,ffnnhhrriixxnnddeeoottmmssoonnffttttooteeddnn,,iinnhhrriieettmmggllnnooffeessooeeffemmddnniiiiggllrrbbiittoonneeooppsseeeffaammaaaaiirrbbiiittaann..nniiooppsseerrssaallaaaattggsshhiieeaann..iihhssrrss..lliiddttggsshhnnsseehh..ii,,..ddnnss,,.. CClliisshhCCllttiioosshhoottooooffoossooppffeessaappeeerraaeenneerrnnvveenniittnnrrvveeooiittrrnnnneeoovvmmnnniirrvvmmeeooiirrnnnneeoottnnmmnnttttmmooeettnnooddeettiinnddssssttppiisssllppaallyyaaffyyrrooffrrmmoomm DDaassiiaaDDssllssppiiisssllllppttiiaassllooyyttaarrooooyyggrrbboorrggjjiibbeeddrrjjcciieeddttccssttss cJJchhuuccJJuummhhuunnuummppkknnppttkkoottoo ccSooShheeppSSococuutttthheeppiiknknoouuttttnnkkiinnnkkooiinnsskkttnnrriissttrr cRaRacoolluuccRaRallddnnoollppuulleeddrrnnttppeehheeccrrttvvhhiieehhccssiiuuoovvhhiiaassiinnuuuuoonnaakkssnnuuddnnsskkssddss RccRoouuccRRddnnoouueeddnntthheecctthhiihhccssuuhhiissnnuukknnkk NNccuuaacNcNrruummrraaeerrmmeerrnneeeettoonnppffttoorrppffoorrjjooeejjcceettcctt ssRReeSSRsRsrrtteeSSuuvvrrttddeeuuvvrriiddeeoo..RRrriioo..rr,,RReeuurrcc,,eeooiiuucc..ggRRooii..nn,,ggRRiiaannzz,,nneeiiaazzddssnneettddssgghhllttggaaoohhllttbbaaooffttaaiibbllffeellaaii..llssRReell..nnssRRbbaanneebbmmaalleeoommeellnnooddeeggnnddaaggttppooaattpppooaa..ppRRaass..hh,,RRssiihhnn,, iiyynnaayyppaapppppp tDDtyyiiDtDtppssyyppiieeppssllppeewwaallyywwiiaattssyyhhiissttshhssaasshhvvssaaooeehhvvddrrooeettddrrooddttbbeeooddjjssbbeeeeccjjccsseerrccttiiccsspprrttiittbbssppiiooyyttbbiinnooyynn vVVviiiieevvVVeeiiiwwwweeewweewiirrnneeiirrnnddaaddttaaaattaa VssVooiiVsVseeuuooiiwweerruuccwwffrreeuuccffeeccnnuuooccccnnddttoocciieeooddttiinneeoonn RRSSRRttSSuuttdduuiiddooiioooppooeeppnneessnnppssllppoollttoossttiissnniinnaa aaddeeddddeeiiddcciiaaccttaaeettddeeddPPllPPoollttoossttppssaappnnaaeennee JJuuJJmmuummpp ppttoottooffuuffnnuuccnnttcciioottiinnoonniinniinnffiillffeeiillee cscMMsnnooMcMscsuuiimmnnoopplluuttiimmppmmiippll--tteellppmmiiaaoo--tteellssnnnnaaoottggttssnnnnbboouuggCCttllbbaaoooqquuhhCCllggccuuaaooqqaahheekkiiggccuunnccaasseecckkiiggkknnccoooosslleeccggkkyyddffoooolleeffcceeuuyyiiddffllooffsseecceeuuiiddeelloosseetteeyyddeett..ppeeyyee..ppee CfCfoorrfCCflleeooddrraalleeeddttaarreeeettrree fUUfiillppfUfUeeiillllppeeoollaaooddaaddDDffiilleefDDfeeiilllleeeeelltteeeetteefRfRiilleeRfRfeeiinnlleeeeaannmmaammee ee dCCdiihhdCCdrreeaaiihhrrccnneeaattggccnnooeettggrrooyyeerryy rNrNeeaaNrNrccGGeevveeaaccUUiiGGnnggvveeIIUUiittaannggPPttppIIttaaeeaaPPllttppoocceeaallkkttooccssaakkttggssaaeeOOwwggeemmppOOwwiinneemmppiiaaddnnnneennooaaddnniiaawwnnnnooggiiaawwnneeggrreepEpEllrriixxllsspEpElloottppiixxllsssttoooottppeessttrroovvtteerreevvttrreeyyppDDrriiyylleennppDDooiillsslleenntteoottllttssaatteeeettllttaalleeeellllddeeDaaDddpplleeDDaallaappllllppcceeellaakklllttppccooeeeeaakklltttooggeessaaeettggssee PIPInnaaPIPIssnnccttaasskkaaccttaallkkaallggaalllleeggsseess PUUPaappUUPPccaaddppkkccaaddaakkttggaaeeaaeettggeesseessllCCiibbrrClCleeiirrbbrraaaaeerrrrttaaaeeyyrrttffeerryyooeeffrrrrppooeeyyrrrrppooooyyrrdduuooouurrdduuccppuurriirrccbbppooiillrrbbjjeeooeelljjeeppcceettaappccccttaakkccaakkggaaeeggee RaaRppuuRRaappnnppuuppnn vCvlClooiihheellvvCCccooooiiwwaahheeccoottoowwaaiiaassooottppeeiiaannssooppppeennttppoottoosPPosohhrruuPoPssoiisshhbbnnrruueeiillyyssbbnniirrssaaeellvvyyhhiipprreessaavvpphhrrttppeeoosspprrtt..ooiissoo..iiooMaMppaccuuapaMMpaaccbbccnnuuooaaccllaabbiinnuuoossggllaannhhiiuueessggttnnhhsseettss ccWWDDPPoorriiccDWDWPPoorreemmooeerriirrssoorreekkccmmssmmeerrssttiikkccnnoossmmaattiiggrrnnoonnyyaaggttrrddnnooyyttddhhoossiieehhsssseettiieessooeettrrooyyrryy mMDMDbbmoorrDmMbDMmbaaiiaannuuxxoorraaggiiaaiiinnnnuummmmxxggppddiiinnmmmaaiiiiaappddzzzznnrreeeeaaiiiaiizzzeeee,,nnrreeppeiisseee,,aappssnnaaeennsseess PPaaPPttaahhtthhttoottooddiiddssppiissllppaallyyaaeeyyddeedddiiddrreeiirrcceettccoottrrooyyrryy CCAAllCCAAFFiicciillFFlliikkeecciillookkeebbnnoorrbboonnffrriiwwoollffeeiiwwsslleeooeessrrrrooeekkddrrreeiikkddrryyeeeiieerrccyyeeddeettccooddttttrrooooyyttrrooyynnyyooyyaannuuoommaarruummwweerr wwooeettoorroottkkooorriikknnppooiiggeennppnnggddee..iinnddrr..eeiirrcceettccoottrrooyyrr..yy.. ClClppiiaabbllppllCCiiiiccccrraabblliikkkkaaccccrraarrkkttkkaaggyyooaarrttee((ggyyooll))ooeeww((..llaa))UUoowwii..ddttaannUUhhiiddttppccnnhhddllaappcciieeccccddllaaiikkttkkeecccaaaattkkttkccooggaaaatthheeccooggdd((hheewwee))dd((ttwwiiee))aatthhttcciiaatthhhcchh PviviPnneeaaiPvvPissnnrrcceettaassssaakkrriiccttooaassllaakklliiggeennooaalllleeddggeenneedd fDDlfliirrbbooeefDlfDliirrrllmmbbooeeaaerrllmmrrttaaeeeeyyrrtteeyy DDDDeeeebbbbuuuuggggMMMMooooddddeeeedOdOeeppOddObbeeeeppuunnbbeegguunnwwggggeewwiiggttrrhheeiittmmrrhhddmmooeeddddbbooeeeeuuddbbggeewwuu((ggwwhh))((,,eehh))bbnn,,eerrbbnniioottrriieewwoottnneewwssccnneeoossccrreeuuoo((rr))nnuu((,,tt))nneeoo,,ttrrrreeoossaarrraassaabbaabbrrbbeerrbbeerraaeerraakkeeaakkppaakkppookkppooppiioonniioonniittnnii..ttnnttRRww..ttSSRRwwhhttSSiiuuhhlltteeddiiuulliieeeddooxxiieeooeewwxxcceewwiiuullcclliittuullooiillnnttppooiiggnneeppnnggcceeoonnccttddhhootteeeeddhh..eee.. mLLmooaaffmoLLmooouueeaaffddoorrnnuueerreeddccoorrnnrrhheeffrrccoorrhhooddffrrrrmmeeooddbbmmeeoouubbrrggoouuiiggggrrggiieeigggnnrreeiinnrr VVVVeeeerrrrssssiiooiioonnnnCCCCoooonnnnttttrrrroooollllfSSfiillttSffSeeaaTTiillttssgguueeaaTT::eessrrgguunn::eerrnnoonnoodSdSnnaahhiiddSSffffttooaahhiiffffTTwwttooooTTwwffooooiillllffeeoossiillllee>>ss >>PPsCsCrrttPPooCCssaaoorrttmmggoojjaaooeeeemmggmmjjccddeeeettmmiiccddffttiiOOttlliiffeettiiOOppllsswweettppiisswwttPPooiittoottiiuunnttPPooiihhoottrrssssuunneehhhhGGrrss>>ssmmee//hhGGiiPP>>mmGGoott//uuiiPPiittGGoooottttlleeuull//iittrroottlleeSSll//SSrrVVSSHVHVVVNNSSVViiiiVHHVeeNNVVNNssiiwwttiieeNNssoowwttrrooyyrryy bbOttOhheeppbbttOOeehhffeeeeooppeeffnnffuurreeooeeffnnnttuurrrreettccnnaatthhttrrttcccciieeaahhooeettcciieeennbbooeerrssaaeennbbrrooccrrttssaarrhhkkrrooccttaahhoottkkrrttooaaccoottRRccttooeeccuuRRccxxcceerraaaauuccxxrrmmlleerraaallrreeddmmlleeiillddnneeddiieeddnnee RRSSRRttSSuuttdduuiiddooiioooppooeeppnneessnnddssooddccoouuccmmuummeenneettnnaattttaaiioottiinnoonniinniinnaa aaddeeddddeeiiddcciiaaccttaaeettddeeddHHeeHHlleeppllpppaappnnaaeennee ClbabalCiinnddrrlllCCblaabiieeiieeccddnnddrrllaaiikkee//eennccddkkrraannkkuuee//ppnnkkrreemmmmnnoouueeppxxeeiimmmoooottbbnnxxiittvveettoottbbnnoo..eerrttvveettoott..eeaarroottaaoo A??MRRMDAD•••••••••• MA?AMRD?RD••••••MDURMURAADddeeeennUMDUMRDRAAoonnddllttddeeddeenneoorraaeennddllaaiittttddeeffmmddeerraacciieeaaiitteeddffmmkkddeeeecciiddeeeeddddkkeeddddeedddd ttOOyyppttOOppyyeeeepppnneeeccnnoosscchhmmoosseehhmmmmlleell mmllttaalloonnttaaooddnnssddss HHhheeooHHhhllmmeeppoollffmmppeeuufflleeppuullaalliippnnllggaaiikknneeggsskkeeoossffooff ShhSeeeeShShaalleeepprraallccppffrrhhiiccllffeehhiiwwlleewwiitthhiittiihhnniinn ShhSeeeeSShhaalleeepprraallccppffrrhhiiccllffeehhiiffllooeeffrroorr HlpwewelpHiinnxxaaiiewpelHwHplhhggeeiieeuunnxxaaeeiihhhhccggeesseessuurruueelleeeehhcchiissttssggrrdduullooeeiieehhiihhoottggddwwooiittnnhhooeewwssttnnhhddeessaahhddssaass VViiVVeeiiwwRReeMMwweeRRrrMMaaeePPrrraakkaaPPrrddnnkkaaooeeddnnwwooeeddwwnniiddssnnpprriisseellpprraappeellyyooaappssrryyoottHHssssrrtt,,TTHHssaaMM,,TTnnaaMMLLddnnLLccddiioonncciinnttoonneettnnttrreeeeaattnnrreeccaattnntt,,cciittvvsstt,,uueeiivvssccuueevvhhiiccssvvhhaauuiissssaaauullSSssaaiizzhhllSSaaiiiizzhhnnttaaiiiyyoonnttiinnaayyoossppnnaappssppsspp,,ss,, PPPPaaaacccckkkkaaaaggggeeeeWWWWrrrriittiittiinniinngggg bbccuurrcbbcaarruurrrrnnaaeerrccrrnnnneehhccttnnhhtt eeRReexxnnuuReeeReevvnnxxnnuucciieerrvvnnccuuoocciioottrrccuunniioommoooottmmnniinnmmoommmmeennhhmmnnaaeeaahhttnnnnaassaawwddttnnppsssswwhhddaappiieesshhuunnaarriieesseeuunneerrsseeddeedd iEEeeinnnnxxiiEEeeaanneevvnnxxmmxxiiaaeerrvveeoommxxiiiiccrrnneennoouuiieeccmmnnnnttuuiieevvmmnneettaaiivvnnggnneerraaiittnnggaarriittbbaallbbeellsseess SddSiinneeeediSdiSnnttllbbeeeeerruuaattllbbcceerrccggttuuaacceeffccggttuubbeeffnnaauubbccccnnaattkkccciiootttkkooiinnoottoonn TREHERHTTTuunnooRHEERTHTeeooTTrraaxxuunnlloooonneeooyyppbbrraaxxllllooggnnppssllyyppbb>>eeeellggrr>>ppssllnnoo>>RReerreerroo>>jjPPnnooooggRRrreeNNFFxxoorruujjxxPPccyyooggiieeooeeNFFNxxttllyyiiggrruuxxccddeeyywwjjiiooiiggeeeetteellyyiinnggeeddee>>nnwweejjiiccggeetteeDDnneeaaoonntt>>nneeNNddccttttiiDDaaOOoonnrrppttoQQeeNNddtteeiiaaccOOppwwrrppooQQuueeccuueeccttaaccppwwiittuukkmmiiccccPPuuccoooottaaiittkkkkrrmmiiccrrPPeeoonnggooooaayykkRRnnrreerrsseennggjjooyytt,,>>eeeeRRnnee>>ssaajjffcctt,,>>eeeeRRttee>>BBaattiiffccoorrRRtteePPuu>>BBttiieennoorraaiiPPuu>>nnlleennwwccddaaiiccnnllkkwwiieeccddTTttccaakkhhiiooeeTTttggaahhooooeegglloosseellss SaSaVVppttSaSaooiiVVppeeppttppooiiwwppeeppSSww((hhSS<<((iihhddnn<<iiaayyddnnttaayyaatt>>aa))>>oo))ppooeeppnnrrPPeeppssuunnrrPPuuppssbbsuubbppuullssbbiissrrbbssppllee,,hhiissrrssRRaaee,,hhttddSSRRaaoossCCttddSSoohhssoossCChheehhnnssooiieehheennnnnnttiieeyyeennnllttaaiiccyyeekkppllttaaiieecc,,kkpppptt……eevv,,ssppii……..eevviissooiiww..eeii,,oowwoo,, ffooddffRRaaddeettRRaaaaffeerrtteeaassffrreesseesshhtteesshhtt aacScSoottttaaSScceeddaaoottttppeeeddaattppiitteeoommhhttiittnnoorrmmhheeooeennrreeuuooeelliigguunnllhhiiggeennhhee ttoSoSoottuuototSSeeoorrttttuuppuueeoorrttnnppuuiiffoonnnnffiiffttuunnooffnnttuuooaaccnnnnttaacciiddoonnttiinnddoossnnss eRRexxeeeRReeessxxeeccuueessuummccuuttuummiieeoottiinneeoonnQQmmuumQQmooiiuuddttooiieeddddtteeeeddbbeeuubbgguugg FFooiirroFFollttvviirreellaattvvrreellaauurrrroolleeuurrwwooeerraawwssrrnnaabbssggnnyybbeeggvvyyeeaavvllaauulleeuuee vvSSaaoovvSSllrraauuoottlleerruubbttsseeyybbssyy ffSSooeeffSSrrooaaeevvrrrraaaccvvrrllhhaauuccllhheeuuee RRSSRRttSSuuttdduuiiddooii®®ooii®®ssiiaass ttaarraattrrddaaeeddmmeemmaarraakkrrookkffooRRffSSRRttSSuuttdduuiiddooii,,ooIInn,, IIccnn..cc••.. CC•• CCCCCCBBYYBBSSYYAASSAARRSSRRttSSuuttdduuiiddooiioo•• ii••nniiffnnooff@@oo@@rrssrrttuussttdduuiiddooii..ooccoo..ccmmoomm•• 88•• 44884444--444--44448844--8811--221111222211••22rr••ssrrttuussttdduuiiddooii..ooccoo..ccmmoomm•• LL•• eeLLaaeerraannrrnnmmmmoorrooeerraaeettaawwtt wwwwww..wwrrss..rrttssuuttdduuiiddooii..ooccoo..ccmmoomm•• RR•• SSRRttSSuuttdduuiiddooiiooIIDDIIEEDDEE00..0099..9999..9988..3388223322•• UU•• ppUUddppaaddttaaeettddee::dd22::002211006611--6600--110011

1 LAYOUT Windows/Linux Mac 4 WRITE CODE Windows /Linux Mac WHY RSTUDIO SERVER PRO? Move focus to Source Editor Ctrl+1 Ctrl+1 Attempt completion Tab or Ctrl+Space Tab or Cmd+Space RSP extends the the open source server with a Move focus to Console Ctrl+2 Ctrl+2 Navigate candidates commercial license, support, and more: Move focus to Help Ctrl+3 Ctrl+3 Accept candidate / / Show History Ctrl+4 Ctrl+4 Dismiss candidates Enter, Tab, or Enter, Tab, or • open and run multiple R sessions at once Show Files Ctrl+5 Ctrl+5 Undo Esc Esc • tune your resources to improve performance Show Plots Ctrl+6 Ctrl+6 Redo Ctrl+Z Cmd+Z • edit the same project at the same time as others Show Packages Ctrl+7 Ctrl+7 Cut Ctrl+Shi +Z Cmd+Shi +Z • see what you and others are doing on your server Show Environment Ctrl+8 Ctrl+8 Copy Ctrl+X Cmd+X • switch easily from one version of R to a di erent version Show Git/SVN Ctrl+9 Ctrl+9 Paste Ctrl+C Cmd+C • integrate with your authentication, authorization, and audit practices Show Build Ctrl+0 Ctrl+0 Select All Ctrl+V Cmd+V Delete Line Ctrl+A Cmd+A Download a free 45 day evaluation at Select Ctrl+D Cmd+D www.rstudio.com/products/rstudio-server-pro/ Select Word Shi +[Arrow] Shi +[Arrow] 2 RUN CODE Windows/Linux Mac Select to Line Start Ctrl+Shi + / Option+Shi + / 5 DEBUG CODE Windows/Linux Mac Search command history Ctrl+ Cmd+ Select to Line End Alt+Shi + Cmd+Shi + Toggle Breakpoint Navigate command history Select Page Up/Down Alt+Shi + Cmd+Shi + Execute Next Line Shi +F9 Shi +F9 Move cursor to start of line // Select to Start/End Shi +PageUp/Down Shi +PageUp/Down Step Into Function F10 F10 Move cursor to end of line Delete Word Le Shi +Alt+ / Cmd+Shi + / Finish Function/Loop Change working directory Home Cmd+ Delete Word Right Ctrl+Backspace Ctrl+Opt+Backspace Continue Shi +F4 Shi +F4 Interrupt current command End Cmd+ Delete to Line End Option+Delete Stop Debugging Clear console Ctrl+Shi +H Ctrl+Shi +H Delete to Line Start Tab (at start of line) Ctrl+K Shi +F6 Shi +F6 Quit Session (desktop only) Indent Shi +Tab Option+Backspace Shi +F5 Shi +F5 Restart R Session Esc Esc Outdent Ctrl+U Tab (at start of line) Shi +F8 Shi +F8 Run current line/selection Ctrl+L Ctrl+L Yank line up to cursor Ctrl+K Shi +Tab Run current (retain cursor) Ctrl+Q Cmd+Q Yank line a er cursor Ctrl+Y Ctrl+U Run from current to end Ctrl+Shi +F10 Cmd+Shi +F10 Insert yanked text Alt+- Ctrl+K 6 VERSION CONTROL Windows/Linux Mac Run the current function Ctrl+Enter Cmd+Enter Insert <- Ctrl+Shi +M Ctrl+Y Show di Ctrl+Alt+D Ctrl+Option+D Source a file Insert %>% F1 Option+- Commit changes Ctrl+Alt+M Ctrl+Option+M Source the current file Alt+Enter Option+Enter Show help for function F2 Cmd+Shi +M Scroll di view Ctrl+ / Ctrl+ / Source with echo Ctrl+Alt+E Cmd+Option+E Show source code Ctrl+Shi +N F1 Stage/Unstage (Git) Ctrl+Alt+F Cmd+Option+F New document Ctrl+Alt+Shi +N F2 Stage/Unstage and move to next Spacebar Spacebar New document (Chrome) Ctrl+O Cmd+Shi +N Enter Enter Ctrl+Alt+G Cmd+Option+G Open document Ctrl+S Cmd+Shi +Opt+N Ctrl+Shi +S Cmd+Shi +S Save document Ctrl+W Cmd+O Ctrl+Shi +Enter Cmd+Shi +Enter Close document Ctrl+Alt+W Cmd+S Close document (Chrome) Ctrl+Shi +W Cmd+W 7 MAKE PACKAGES Windows/Linux Mac Close all documents Ctrl+Alt+X Cmd+Option+W Build and Reload Ctrl+Shi +B Cmd+Shi +B Extract function Ctrl+Alt+V Cmd+Shi +W Load All (devtools) Ctrl+Shi +L Cmd+Shi +L 3 NAVIGATE CODE Windows /Linux Mac Extract variable Ctrl+I Cmd+Option+X Test Package (Desktop) Ctrl+Shi +T Cmd+Shi +T Goto File/Function Ctrl+. Ctrl+. Reindent lines Ctrl+Shi +C Cmd+Option+V Test Package (Web) Ctrl+Alt+F7 Cmd+Opt+F7 Fold Selected Alt+L Cmd+Option+L (Un)Comment lines Ctrl+Shi +/ Cmd+I Check Package Ctrl+Shi +E Cmd+Shi +E Unfold Selected Shi +Alt+L Cmd+Shi +Option+L Reflow Comment Ctrl+Shi +A Cmd+Shi +C Document Package Ctrl+Shi +D Cmd+Shi +D Fold All Alt+O Cmd+Option+O Reformat Selection Ctrl+Shi +E Cmd+Shi +/ Unfold All Shi +Alt+O Cmd+Shi +Option+O Select within braces Ctrl+Shi +Alt+P Cmd+Shi +A 8 DOCUMENTS AND APPS Windows/Linux Mac Go to line Shi +Alt+G Cmd+Shi +Option+G Show Diagnostics Alt+ / Ctrl+Shi +E Preview HTML (Markdown, etc.) Ctrl+Shi +K Cmd+Shi +K Jump to Shi +Alt+J Cmd+Shi +Option+J Transpose Letters Shi +Alt+ / Cmd+Shi +Opt+P Knit Document (knitr) Ctrl+Shi +K Cmd+Shi +K Switch to tab Ctrl+Shi +. Ctrl+Shi +. Move Lines Up/Down Ctrl+Alt+Up Ctrl+T Compile Notebook Ctrl+Shi +K Cmd+Shi +K Previous tab Ctrl+F11 Ctrl+F11 Copy Lines Up/Down Ctrl+Alt+Down Option+ / Compile PDF (TeX and Sweave) Ctrl+Shi +K Cmd+Shi +K Next tab Ctrl+F12 Ctrl+F12 Add New Cursor Above Ctrl+Alt+Shi +Up Cmd+Option+ / Insert chunk (Sweave and Knitr) Ctrl+Alt+I Cmd+Option+I First tab Ctrl+Shi +F11 Ctrl+Shi +F11 Add New Cursor Below Ctrl+Alt+Shi +Down Ctrl+Option+Up Insert code section Ctrl+Shi +R Cmd+Shi +R Last tab Ctrl+Shi +F12 Ctrl+Shi +F12 Move Active Cursor Up Ctrl+F Ctrl+Option+Down Re-run previous region Ctrl+Shi +P Cmd+Shi +P Navigate back Ctrl+F9 Cmd+F9 Move Active Cursor Down Ctrl+F3 Ctrl+Option+Shi +Up Run current document Ctrl+Alt+R Cmd+Option+R Navigate forward Ctrl+F10 Cmd+F10 Find and Replace Ctrl+Shi +J Ctrl+Opt+Shi +Down Run from start to current line Ctrl+Alt+B Cmd+Option+B Jump to Brace Ctrl+P Ctrl+P Use Selection for Find Cmd+F Run the current code section Ctrl+Alt+T Cmd+Option+T Select within Braces Ctrl+Shi +Alt+E Ctrl+Shi +Option+E Replace and Find Cmd+E Run previous Sweave/Rmd code Ctrl+Alt+P Cmd+Option+P Use Selection for Find Ctrl+F3 Cmd+E Cmd+Shi +J Run the current chunk Ctrl+Alt+C Cmd+Option+C Find in Files Ctrl+Shi +F Cmd+Shi +F Run the next chunk Ctrl+Alt+N Cmd+Option+N Find Next Win: F3, Linux: Ctrl+G Cmd+G Sync Editor & PDF Preview Ctrl+F8 Cmd+F8 Find Previous W: Shi +F3, L: Cmd+Shi +G Previous plot Ctrl+Alt+F11 Cmd+Option+F11 Jump to Word Ctrl+ / Option+ / Next plot Ctrl+Alt+F12 Cmd+Option+F12 Jump to Start/End Ctrl+ / Cmd+ / Show Keyboard Shortcuts Alt+Shi +K Option+Shi +K Toggle Outline Ctrl+Shi +O Cmd+Shi +O Learn more at www.rstudio.com • RStudio IDE 0.1.0 • Updated: 2017-09

Shiny : : CHEAT SHEET Basics Building an App Complete the template by adding arguments to fluidPage() and a Inputs body to the server function. A Shiny app is a web page (UI) connected to a collect values from the user computer running a live R session (Server) Add inputs to the UI with *Input() functions library(shiny) Access the current value of an input object with ui <- fluidPage( input$<inputId>. Input values are reactive. Users can manipulate the UI, which will cause Add outputs with *Output() functions the server to update the UI’s displays (by numericInput(inputId = \"n\", ac…tio) nButton(inputId, label, icon, running R code). Tell server how to render outputs with R in \"Sample size\", value = 25), the server function. To do this: actionLink(inputId, label, icon, …) APP TEMPLATE plotOutput(outputId = \"hist\") Begin writing a new app with this template. ) checkboxGroupInput(inputId, label, Preview the app by running the code at the R choices, selected, inline) command line. 1. Refer to outputs with output$<id> server <- function(input, output) { 2. Refer to inputs with input$<id> output$hist <- renderPlot({ chveaclukeb)oxInput(inputId, label, library(shiny) 3. Wrap code in a render*() function before hist(rnorm(input$n)) ui <- fluidPage() saving to output }) dateInput(inputId, label, value, min, server <- function(input, output){} max, format, startview, weekstart, shinyApp(ui = ui, server = server) } language) • ui - nested R functions that assemble an shinyApp(ui = ui, server = server) dateRangeInput(inputId, label, HTML user interface for your app start, end, min, max, format, Save your template as app.R. Alternatively, split your template into two files named ui.R and server.R. startview, weekstart, language, • server - a function with instructions on how separator) to build and rebuild the R objects displayed library(shiny) # ui.R ui.R contains everything in the UI ui <- fluidPage( fluidPage( you would save to ui. filaecIcnepputt)(inputId, label, multiple, server.R ends with the • shinyApp - combines ui and server into numericInput(inputId = \"n\", numericInput(inputId = \"n\", numericInput(inputId, label, value, an app. Wrap with runApp() if calling from a \"Sample size\", value = 25), \"Sample size\", value = 25), function you would save min, max, step) sourced script or inside a function. to server. plotOutput(outputId = \"hist\") plotOutput(outputId = \"hist\") SHARE YOUR APP ) ) No need to call The easiest way to share your app server <- function(input, output) { shinyApp(). is to host it on shinyapps.io, a # server.R cloud based service from RStudio output$hist <- renderPlot({ function(input, output) { hist(rnorm(input$n)) 1. Create a free or professional account at output$hist <- renderPlot({ http://shinyapps.io }) hist(rnorm(input$n)) } 2. Click the Publish icon in the RStudio IDE shinyApp(ui = ui, server = server) }) or run: } rsconnect::deployApp(\"<path to directory>\") Build or purchase your own Shiny Server Save each app as a directory that holds an app.R file (or a server.R file and a ui.R file) plus optional extra files. at www.rstudio.com/products/shiny-server/ app-name The directory name is the name of the app .r app.R (optional) defines objects available to both Launch apps with global.R ui.R and server.R runApp(<path to DESCRIPTION (optional) used in showcase mode directory>) (optional) data, scripts, etc. README <other files> (optional) directory of files to share with web www browsers (images, CSS, .js, etc.) Must be named \"www\" Outputs - render*() and *Output() functions work together to add R output to the UI passwordInput(inputId, label, DT::renderDataTable(expr, options, wwoirtkhs dataTableOutput(outputId, icon, …) value) callback, escape, env, quoted) racdhiooiBcuestt,osenlse(cintepdu,tiIndl,inlaeb)el, rednedleetreImFilaeg)e(expr, env, quoted, imcaligcke,Odubtlpculict(ko,uhtopvuetrI,dh,owviedrtDhe, lhaeyi,gihntl,ine, selectInput(inputId, label, choices, hoverDelayType, brush, clickId, hoverId) selected, multiple, selectize, width, renderPlot(expr, width, height, res, …, plotOutput(outputId, width, height, click, size) (also selectizeInput()) env, quoted, func) dblclick, hover, hoverDelay, inline, sliderInput(inputId, label, min, max, hoverDelayType, brush, clickId, hoverId) value, step, round, format, locale, ticks, animate, width, sep, pre, rewniddetrhP) rint(expr, env, quoted, func, verbatimTextOutput(outputId) post) renderTable(expr,…, env, quoted, func) tableOutput(outputId) submitButton(text, icon) (Prevents reactions across entire app) renderText(expr, env, quoted, func) textOutput(outputId, container, inline) textInput(inputId, label, value) renderUI(expr, env, quoted, func) & uiOutput(outputId, inline, container, …) htmlOutput(outputId, inline, container, …) RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more at shiny.rstudio.com • shiny 0.12.0 • Updated: 2016-01

Reactivity UI - An app’s UI is an HTML document. Layouts Reactive values work together with reactive functions. Call a reactive value from within the arguments of one Use Shiny’s functions to assemble this HTML with R. Combine multiple elements of these functions to avoid the error Operation not allowed without an active reactive context. into a \"single element\" that fluidPage( Returns has its own properties with textInput(\"a\",\"\") HTML a panel function, e.g. ) ## <div class=\"container-fluid\"> wellPanel(dateInput(\"a\", \"\"), submitButton() ## <div class=\"form-group shiny-input-container\"> ) ## <label for=\"a\"></label> absolutePanel() ## <input id=\"a\" type=\"text\" conditionalPanel() fixedPanel() ## class=\"form-control\" value=\"\"/> headerPanel() navlistPanel() inputPanel() sidebarPanel() ## </div> mainPanel() tabPanel() tabsetPanel() ## </div> titlePanel() wellPanel() Add static HTML elements with tags, a list of functions that parallel common HTML tags, e.g. Organize panels and elements into a layout with a tags$a(). Unnamed arguments will be passed layout function. Add elements as arguments of the into the tag; named arguments will become tag layout functions. attributes. tags$a tags$data tags$h6 tags$nav tags$span fluidRow() tags$abbr tags$datalist tags$head tags$noscript tags$strong tags$address tags$dd tags$header tags$object tags$style ui <- fluidPage( tags$area tags$del tags$hgroup tags$ol tags$sub rcolwumn col fluidRow(column(width = 4), column tags$article tags$details tags$hr tags$optgroup tags$summary column(width = 2, offset = 3)), tags$aside tags$dfn tags$HTML tags$option tags$sup fluidRow(column(width = 12)) tags$audio tags$div tags$i tags$output tags$table ) CREATE YOUR OWN REACTIVE VALUES RENDER REACTIVE OUTPUT tags$b tags$dl tags$iframe tags$p tags$tbody # example snippets *Input() functions render*() functions tags$base tags$dt tags$img tags$param tags$td flowLayout() library(shiny) tags$bdi tags$em tags$input tags$pre tags$textarea (see front page) ui <- fluidPage( (see front page) tags$bdo tags$embed tags$ins tags$progress tags$tfoot object object object ui <- fluidPage( tags$blockquote tags$eventsource tags$kbd tags$q tags$th 12 3 flowLayout( # object 1, ui <- fluidPage( reactiveValues(…) textInput(\"a\",\"\",\"A\"), Builds an object to tags$body tags$fieldset tags$keygen tags$ruby tags$thead object 3 textInput(\"a\",\"\",\"A\") textOutput(\"b\") display. Will rerun code in tags$br tags$figcaption tags$label tags$rp tags$time # object 2, ) body to rebuild the object tags$button tags$figure tags$legend tags$rt tags$title sidebarLayout() # object 3 ) server <- whenever a reactive value ) function(input,output){ in the code changes. side main ) Each input function output$b <- Save the results to tags$canvas tags$footer tags$li tags$s tags$tr panel panel ui <- fluidPage( creates a reactive value output$<outputId> tags$caption tags$form tags$link tags$samp tags$track sidebarLayout( server <- stored as input$<inputId> renderText({ tags$cite tags$h1 tags$mark tags$script tags$u sidebarPanel(), function(input,output){ lriesat cotfirveeaVcatilvueesv(a)luceresates a input$a tags$code tags$h2 tags$map tags$section tags$ul mainPanel() whose values you can set. tags$col tags$h3 tags$menu tags$select tags$var ) rv <- reactiveValues() }) tags$colgroup tags$h4 tags$meta tags$small tags$video ) rv$number <- 5 } } shinyApp(ui, server) tags$command tags$h5 tags$meter tags$source tags$wbr PREVENT REACTIONS TRIGGER ARBITRARY CODE The most common tags have wrapper functions. You do not need to prefix their names with tags$ library(shiny) ui <- fluidPage( isolate(expr) library(shiny) observeEvent(eventExpr ui <- fluidPage( splitLayout() ui <- fluidPage( h1(\"Header 1\"), object object splitLayout( # object 1, textInput(\"a\",\"\",\"A\"), Runs a code block. ui <- fluidPage( , handlerExpr, event.env, hr(), 12 textOutput(\"b\") textInput(\"a\",\"\",\"A\"), event.quoted, handler.env, br(), # object 2 ) Returns tahneornes-rueltasc.tive actionButton(\"go\",\"Go\") handler.quoted, labe, p(strong(\"bold\")), ) server <- copy of ) suspended, priority, domain, p(em(\"italic\")), ) function(input,output){ p(code(\"code\")), output$b <- server <- autoDestroy, ignoreNULL) a(href=\"\", \"link\"), verticalLayout() ui <- fluidPage( function(input,output){ HTML(\"<p>Raw html</p>\") verticalLayout( # object 1, renderText({ observeEvent(input$go,{ object 1 isolate({input$a}) print(input$a) Runs code in 2nd ) object 2 # object 2, }) argument when reactive object 3 # object 3 }) } values in 1st argument ) } ) shinyApp(ui, server) shinyApp(ui, server) change. See observe() for To include a CSS file, use includeCSS(), or alternative. 1. Place the file in the www subdirectory 2. Link to it with MODULARIZE REACTIONS DELAY REACTIONS Layer tabPanels on top of each other, tags$head(tags$link(rel = \"stylesheet\", and navigate between them, with: ui <- fluidPage( reactive(x, env, quoted, library(shiny) eventReactive(eventExpr, type = \"text/css\", href = \"<file name>\")) ui <- fluidPage( tabsetPanel( textInput(\"a\",\"\",\"A\"), label, domain) textInput(\"z\",\"\",\"Z\"), ui <- fluidPage( valueExpr, event.env, tabPanel(\"tab 1\", \"contents\"), textOutput(\"b\")) Creates a reactive expression textInput(\"a\",\"\",\"A\"), tabPanel(\"tab 2\", \"contents\"), that actionButton(\"go\",\"Go\"), event.quoted, value.env, To include JavaScript, use includeScript() or tabPanel(\"tab 3\", \"contents\"))) server <- textOutput(\"b\") value.quoted, label, 1. Place the file in the www subdirectory ui <- fluidPage( navlistPanel( function(input,output){ • caches its value to reduce ) domain, ignoreNULL) 2. Link to it with tabPanel(\"tab 1\", \"contents\"), computation tabPanel(\"tab 2\", \"contents\"), re <- reactive({ • can be called by other code server <- Creates reactive tags$head(tags$script(src = \"<file name>\")) tabPanel(\"tab 3\", \"contents\"))) paste(input$a,input$z)}) function(input,output){ expression with code in ui <- navbarPage(title = \"Page\", • notifies its dependencies re <- eventReactive( IMAGES To include an image tabPanel(\"tab 1\", \"contents\"), output$b <- renderText({ when it ha been invalidated input$go,{input$a}) 1. Place the file in the www subdirectory tabPanel(\"tab 2\", \"contents\"), re() output$b <- renderText({ 2. Link to it with img(src=\"<file name>\") tabPanel(\"tab 3\", \"contents\")) Call the expression with re() 2nd argument that only }) function syntax, e.g. re() invalidates when reactive } }) values in 1st argument shinyApp(ui, server) } shinyApp(ui, server) change. RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more at shiny.rstudio.com • shiny 0.12.0 • Updated: 2016-01

R Markdown : : CHEAT SHEET File path to output document 5 .rmd Structure rmarkdown What is R Markdown? 1 Find in document 4 synch publish OYApMtioLnHael asedcetrio n of render (e.g. pandoc) (.R.Rmmdd)fiflieles i·sAanrRecMoradrkodfoywounr 3 button to options written as key:value pairs (YAML). research. It contains the code that a accounts at At start of file scientist needs to reproduce your work plsoercetavtiieown cicnohsdueenrtk go to rcuhnuncok(dse) rpubs.com, Between lines of - - - Rmd along with the narration that a reader shinyapps.io needs to understand your work. 2 ccohduenk publish CRSotnundeicot NTeaxrtra tion formatted with markdown, mixed with: Reproducible Research · At the click of a button, or the type of a command, you Reload document CChoudnekCshoufnekmsb edded code. Each chunk: can rerun the code in an R Markdown file Begins with ```{r} to reproduce your work and export the show ends with ``` results as a finished report. outline R Markdown will run the code and append the results to the doc. Dynamic Documents · You can choose It will use the location of the .Rmd file as the working directory to export the finished report in a variety crpuhrneuvnaikollsus of formats, including html, pdf, MS cmohpoutdinoikfnys rccuhunrurneknt Parameters Word, or RTF documents; html or pdf Parameterize your documents to reuse with based slides, Notebooks, and more. different inputs (e.g., data, values, etc.) --- Workflow 1. Add parameters · Create and set params: parameters in the header as sub- n: 100 values of params d: !r Sys.Date() --- v2a. Cluaelsl pinacraomdeeatesrpsa·raCmalsl $p<anraammeet>er 6 3. Set parameters · Set values wth iTso`drapya’sradmatse$d` Knit with parameters or the params 1 Open a new .Rmd file at File ▶ New File ▶ argument of render(): R Markdown. Use the wizard that opens to pre- populate the file with a template 7 render(\"doc.Rmd\", params = list(n = 1, d = as.Date(\"2015-01-01\")) 2 Write document by editing template render DInotecuramcteinvets 3 Knit document to create report; use knit button or Use rmarkdown::render() to render/knit at cmd line. Important args: render() to knit Tduorcnumyoeunrtrienp4orstteinptso an interactive Shiny input - file to render output_options - output_file params - list of envir - environment encoding - of input 1. Add runtime: shiny to the YAML header. 4 Preview Output in IDE window output_format List of render output_dir params to use to evaluate code file 2. Call Shiny input functions to embed input objects. 5 Publish (optional) to web server options (as in YAML) chunks in 3. Call Shiny render functions to embed reactive output. 6 Examine build log in R Markdown console 4R.SRtuednidoeIrDwEith rmarkdown::run or click Run Document in 7 Use output file that is saved along side .Rmd Embed code with knitr syntax INLINE CODE COnOeDorEmCoHreUlinNeKs sSurrounded with I`n`s`er{rt}wainthd ```. Place chunk SGeLt OwiBthAkLnitOr:P:oTptIsO_cNhuSnk$set(), e.g. Insert with `r <code>`. Results appear as text without code. Built with `r getRversion()` Built with 3.2.3 options within curly braces, after r. ```{r include=FALSE} ```{r echo=TRUE} knitr::opts_chunk$set(echo = TRUE) getRversion() ``` --- ``` output: html_document runtime: shiny IMPORTANT CHUNK OPTIONS (ddeepfaeunldts=oNnU-LcLh)unk dependencies for caching 'fdige.faaluigltn') - 'left', 'right', or 'center' (default = mdoecsusmageent- (ddisepfalauyltc=oTdReUmEe)ssages in --- ```{r, echo = FALSE} cFAacLhSEe)- cache results for future knits (default = echo - Display code in output document (default = fig.cap - figure caption as character string (default results (default = 'markup') numericInput(\"n\", cache.path - directory to save cached results in TRUE) = NULL) 'asis' - passthrough results \"How many cars?\", 5) (default = \"cache/\") 'hide' - do not display results renderTable({ child - file(s) to knit and then include (default = engine - code language used in chunk (default = fig.height, fig.width - Dimensions of plots in 'hold' - put all results below all code head(cars, input$n) NULL) 'R') inches tidy - tidy code for display (default = FALSE) }) collapse - collapse all output into single block error - Display error messages in doc (TRUE) or ``` (default = FALSE) stop render when errors occur (FALSE) (default = highlight - highlight source code (default = TRUE) warning - display code warnings in document comment - prefix for each line of results (default = '##') FALSE) (default = TRUE) (indcelfuaudlet - Include chunk in doc after running Embed a complete app into your document with eval - Run code in chunk (default = TRUE) = TRUE) shiny::shinyAppDir() NOTE: Your report will rendered as a Shiny app, which means eOonupgtt.iieonxnet.sroanp,otostu,lteis.nhtegediingaheb.tp,oaovtueht:,.Rwfi.giod.patthsipo, p,nfrsiog, ma.enpniotv,,ppftiusg,r.ela,xurtet,off.idlgae.bkpee,leb,pare,cnfkidgg.erlopr,u,snfiizdge.,p,csaaptchlhi,te,fi.tgciod.pmyo.omsp, eftisngt.ps,rcoaccehsse,.lfaigz.yr,ectaincah,ef.irge.sbcuailpd,,fciga.cshheo.wva, rfsig,.dshevo,wdteevx.ta,rfgigs.,sdupbic, ap, interval, you must choose an html output format, like html_document, and serve it with an active R Session. RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more at rmarkdown.rstudio.com • rmarkdown 1.6 • Updated: 2016-02









Vector Functions Summary Functions Combine Tables dplyr TO USE WITH MUTATE () TO USE WITH SUMMARISE () COMBINE VARIABLES COMBINE CASES mutate() and transmute() apply vectorized summarise() applies summary functions to xy functions to columns to create new columns. columns to create a new table. Summary ABC Vectorized functions take vectors as input and functions take vectors as input and return single ABC + A BD A B CA B D at 1 return vectors of the same length as output. values as output. a t1 at 3 = a t 1a t 3 x bu 2 vectorized function summary function bu2 bu2 b u 2b u 2 cv3 c v 3dw 1 OFFSETS COUNTS c v3 dw 1 ABC dplyr::lag() - Offset elements by 1 dplyr::n() - number of values/rows dplyr::lead() - Offset elements by -1 dplyr::n_distinct() - # of uniques Use bind_cols() to paste tables beside each + y Cv3 other as they are. dw 4 CUMULATIVE AGGREGATES sum(!is.na()) - # of non-NA’s dddppplllyyyrrr::::::cccccccuuuuuuummmmmmmmaasmpmunlrleaiom(ynax)d((n(()-)())()C---)-C-uCCC-CumuCuuummmuummumluauuulltalulalaiatavltttiaiteviivtivveveiaeevelamelsm(npu)miyranmo(xe()d)((a))(n) () bind_cols(…) Returns tables placed side by Use bind_rows() to paste tables below each LOCATION side as a single table.  other as they are. RANKINGS mmeeadnia(n) (-)m- emaend, iaalnso mean(!is.na()) BE SURE THAT ROWS ALIGN. dplyr::cume_dist() - Proportion of all values <= dplyr::dense_rank() - rank with ties = min, no LOGICALS Use a \"Mutating Join\" to join one table to DF A B C bind_rows(…, .id = NULL) gaps mean() - Proportion of TRUE’s columns from another, matching values with x at 1 Returns tables one on top of the other dplyr::min_rank() - rank with ties = min sum() - # of TRUE’s the rows that they correspond to. Each join as a single table. Set .id to a column dplyr::ntile() - bins into n bins retains a different combination of values from x bu2 name to add a column of the original dplyr::percent_rank() - min_rank scaled to [0,1] POSITION/ORDER the tables. table names (as pictured) dplyr::row_number() - rank with ties = \"first\" dplyr::first() - first value x cv3 dplyr::last() - last value MATH dplyr::nth() - value in nth location of vector z cv3 +, - , *, /, ^, %/%, %% - arithmetic ops log(), log2(), log10() - logs RANK z dw 4 <, <=, >, >=, !=, == - logical comparisons quantile() - nth quantile  min() - minimum value A B C D left_join(x, y, by = NULL, A B C intersect(x, y, …) dplyr::between() - x >= left & x <= right max() - maximum value at 13 copy=FALSE, suffix=c(“.x”,“.y”),…) c v 3 Rows that appear in both x and y. dplyr::near() - safe == for floating point bu22 Join matching values from y to x. numbers SPREAD c v 3 NA setdiff(x, y, …) IQR() - Inter-Quartile Range Rows that appear in x but not y. MISC mad() - median absolute deviation ABCD right_join(x, y, by = NULL, copy = ABC union(x, y, …) dplyr::case_when() - multi-case if_else() sd() - standard deviation at 13 FALSE, suffix=c(“.x”,“.y”),…) at 1 Rows that appear in x or y. dplyr::coalesce() - first non-NA values by var() - variance bu22 Join matching values from x to y. bu2 (Duplicates removed). union_all() element  across a set of vectors d w NA 1 inner_join(x, y, by = NULL, copy = retains duplicates. dplyr::if_else() - element-wise if() + else() FALSE, suffix=c(“.x”,“.y”),…) ABC dplyr::na_if() - replace specific values with NA ABCD Join data. Retain only rows with at 1 at 13 matches. bu2 pmax() - element-wise max() bu22 cv3 pmin() - element-wise min() dw 4 dplyr::recode() - Vectorized switch() dplyr::recode_factor() - Vectorized switch() A B C D full_join(x, y, by = NULL, Use setequal() to test whether two data sets for factors at 13 copy=FALSE, suffix=c(“.x”,“.y”),…) contain the exact same rows (in any order). bu22 Join data. Retain all values, all rows. c v 3 NA d w NA 1 EXTRACT ROWS xy A B.x C B.y D Use by = c(\"col1\", \"col2\", …) to ABC ABD = at 1t 3 specify one or more common +a t 1 Row Names columns to match on. at 3 bu2u2 left_join(x, y, by = \"A\") bu2 bu2 c v 3 NA NA cv3 dw 1 Tidy data does not use rownames, which store a A.x B.x C A.y B.y Use a named vector, by = c(\"col1\" = tUhseeraow\"FsilotfearinnogthJeori.n\" to filter one table against variable outside of the columns. To work with the a t 1dw \"col2\"), to match on columns that rownames, first move them into a column. b u2b u have different names in each table. c v3a t left_join(x, y, by = c(\"C\" = \"D\")) C A B rownames_to_column() semi_join(x, y, by = NULL, …) AB Move row names into col. ABC Return rows of x that have a match in y. 1at 1a t a <- rownames_to_column(iris, var A1 B1 C A2 B2 Use suffix to specify the suffix to at 1 USEFUL TO SEE WHAT WILL BE JOINED. 2bu 2b u bu2 3cv 3 c v = \"C\") a t 1 d w give to unmatched columns that ABC A B column_to_rownames() b u2b u have the same name in both tables. ABC anti_join(x, y, by = NULL, …) 1at c v3a t left_join(x, y, by = c(\"C\" = \"D\"), suffix = cv3 Return rows of x that do not have a 2bu 1at Move col in row names.  c(\"1\", \"2\")) match in y. USEFUL TO SEE WHAT WILL 2bu column_to_rownames(a, var = \"C\") NOT BE JOINED. 3cv 3cv Also has_rownames(), remove_rownames() RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more with browseVignettes(package = c(\"dplyr\", \"tibble\")) • dplyr 0.7.0 • tibble 1.2.0 • Updated: 2017-03



















Document ( man/) Add Data ( data/) man/ contains the documentation for your functions, the help ROXYGEN2 The data/ directory allows you to pages in your package. include data with your package. The roxygen2 package lets you write bUesseidroexiytgsednefcionmitimonents to document each function documentation inline in your .R files with a Save data as .Rdata files (suggested) Document the name of each exported data set shorthand syntax. devtools implements Store data in one of data/, R/Sysdata.rda, inst/extdata Include helpful examples for each function roxygen2 to make documentation. Always use LazyData: true in your DESCRIPTION file. WORKFLOW • Add roxygen documentation as comment lines devtools::use_data() 1. Add roxygen comments in your .R files that begin with #’. Adds a data object to data/ 2. Convert roxygen comments into documentation with one of: (R/Sysdata.rda if internal = TRUE) • Place comment lines directly above the code that defines the devtools::document() object documented. devtools::use_data_raw() Converts roxygen comments to .Rd files and places Adds an R Script used to clean a data set to data-raw/. them in man/. Builds NAMESPACE. • Place a roxygen @ tag (right) after #’ to supply a specific Includes data-raw/ on .Rbuildignore. section of documentation. Store data in • Untagged lines will be used to generate a title, description, • data/ to make data available to package users and details section (in that order) • R/sysdata.rda to keep data internal for use by your functions. Ctrl/Cmd + Shift + D (Keyboard Shortcut) #' Add together two numbers. • inst/extdata to make raw data available for loading and #' parsing examples. Access this data with system.file() 3. Open help pages with ? to preview documentation #' @param x A number. 4. Repeat Organize ( NAMESPACE) #' @param y A number. .Rd FORMATTING TAGS \\email{name@@foo.com} #' @return The sum of \\code{x} and \\code{y}. The NAMESPACE file helps you make your package self- \\emph{italic text} \\href{url}{display} #' @examples contained: it won’t interfere with other packages, and other \\strong{bold text} \\url{url} #' add(1, 1) packages won’t interfere with it. \\code{function(args)} \\link[=dest]{display} #' @export \\pkg{package} \\linkS4class{class} add <- function(x, y) { Export functions for users by placing @export in their \\dontrun{code} \\code{\\link{function}} roxygen comments \\dontshow{code} \\code{\\link[package]{function}} x+y Import objects from other packages with \\donttest{code} \\tabular{lcr}{ } package::object (recommended) or @import, \\deqn{a + b (block)} @importFrom, @importClassesFrom, \\eqn{a + b (inline)} left \\tab centered \\tab right \\cr COMMON ROXYGEN TAGS @importMethodsFrom (not always recommended) cell \\tab cell \\tab cell \\cr } @aliases @inheritParams @seealso data WORKFLOW @concepts @keywords @format 1. Modify your code or tests. @describeIn @source S4 2. Document your package (devtools::document()) @param @include RC 3. Check NAMESPACE @examples @rdname @slot 4. Repeat until NAMESPACE is correct @return @field @export @section SUBMIT YOUR PACKAGE @family r-pkgs.had.co.nz/release.html Teach ( vignettes/) vignettes/ holds documents that teach your users how to solve real problems with your tools. Create a vignettes/ directory and a template vignette with --- title: \"Vignette Title\" devtools::use_vignette() author: \"Vignette Author\" Adds template vignette as vignettes/my-vignette.Rmd. date: \"`r Sys.Date()`\" output: rmarkdown::html_vignette Append YAML headers to your vignettes (like right) Write the body of your vignettes in R Markdown vignette: > (rmarkdown.rstudio.com) %\\VignetteIndexEntry{Vignette Title} %\\VignetteEngine{knitr::rmarkdown} \\usepackage[utf8]{inputenc} --- RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more at http://r-pkgs.had.co.nz/ • devtools 1.5.1 • Updated: 2015-01

Deep Learning with Keras : : CHEAT SHEET Keras TensorFlow Intro Define Compile Fit Evaluate Predict INSTALLATION Keras is a high-level neural networks API • Model • Optimiser • Batch size • Evaluate • classes The keras R package uses the Python keras library. developed with a focus on enabling fast • Sequential • Loss • Epochs • Plot • probability You can install all the prerequisites directly from R. experimentation. It supports multiple back- • Metrics • Validation https://keras.rstudio.com/reference/install_keras.html ends, including TensorFlow, CNTK and Theano. model • Multi-GPU split library(keras) See ?install_keras TensorFlow is a lower level mathematical install_keras() for GPU instructions library for building deep neural network model architectures. The keras R package makes it easy to use Keras and TensorFlow in R. https://keras.rstudio.com The “Hello, World!” This installs the required libraries in an Anaconda https://www.manning.com/books/deep-learning-with-r of deep learning environment or virtual environment 'r-tensorflow'. Working with keras models TRAINING AN IMAGE RECOGNIZER ON MNIST DATA DEFINE A MODEL PREDICT CORE LAYERS # input layer: use MNIST images keras_model() Keras Model predict() Generate predictions from a Keras model mnist <- dataset_mnist() keras_model_sequential() Keras Model composed of predict_proba() and predict_classes() layer_input() Input layer x_train <- mnist$train$x; y_train <- mnist$train$y a linear stack of layers Generates probability or class probability predictions layer_dense() Add a densely- x_test <- mnist$test$x; y_test <- mnist$test$y multi_gpu_model() Replicates a model on different for the input samples connected NN layer to an output GPUs pbaretcdhicotf_soanm_bpaletsch() Returns predictions for a single layer_activation() Apply an # reshape and rescale predict_generator() Generates predictions for the activation function to an output x_train <- array_reshape(x_train, c(nrow(x_train), 784)) COMPILE A MODEL input samples from a data generator ltaoytehre_idnrpouptout() Applies Dropout x_test <- array_reshape(x_test, c(nrow(x_test), 784)) compile(object, optimizer, loss, metrics = NULL) layer_reshape() Reshapes an x_train <- x_train / 255; x_test <- x_test / 255 Configure a Keras model for training output to a certain shape y_train <- to_categorical(y_train, 10) FIT A MODEL OTHER MODEL OPERATIONS dlaimyeern_spieornms ouftea(n) Permute the y_test <- to_categorical(y_test, 10) fit(object, x = NULL, y = NULL, batch_size = NULL, summary() Print a summary of a Keras model to a given pattern input according epochs = 10, verbose = 1, callbacks = NULL, …) export_savedmodel() Export a saved model # defining the model and layers Train a Keras model for a fixed number of epochs get_layer() Retrieves a layer based on either its n layer_repeat_vector() Repeats model <- keras_model_sequential() (iterations) name (unique) or index the input n times model %>% fit_generator() Fits the model on data yielded batch- pop_layer() Remove the last layer in a model layer_dense(units = 256, activation = 'relu', by-batch by a generator save_model_hdf5(); load_model_hdf5() Save/ x f(x) laarybeitrr_alraymexbpdrae(sosbiojencat,sfa) Wraps train_on_batch() test_on_batch() Single gradient Load models using HDF5 files layer input_shape = c(784)) %>% update or model evaluation over one batch of serialize_model(); unserialize_model() layer_dropout(rate = 0.4) %>% samples Serialize a model to an R object L1 L2 layer_activity_regularization() layer_dense(units = 128, activation = 'relu') %>% clone_model() Clone a model instance Layer that applies an update to layer_dense(units = 10, activation = 'softmax’) EVALUATE A MODEL freeze_weights(); unfreeze_weights() the cost function based input Freeze and unfreeze weights activity # compile (define loss and optimizer) model %>% compile( NevUaLlLu)aEteva(olubajetecta, x = NULL, y = NULL, batch_size = layer_masking() Masks a loss = 'categorical_crossentropy', Keras model sequence by using a mask value to optimizer = optimizer_rmsprop(), skip timesteps metrics = c('accuracy’) ) evaluate_generator() Evaluates the model on a data layer_flatten() Flattens an input generator # train (fit) model %>% fit( x_train, y_train, epochs = 30, batch_size = 128, validation_split = 0.2 ) model %>% evaluate(x_test, y_test) model %>% predict_classes(x_test) RStudio® is a trademark of RStudio, Inc. • CC BY SA RStudio • [email protected] • 844-448-1212 • rstudio.com • Learn more at keras.rstudio.com • keras 2.1.2 • Updated: 2017-12
















Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook