大智慧龍軟DTSR語言量化投資云培訓(xùn)RStudio學(xué)習(xí)手冊(中文翻譯)_第1頁
大智慧龍軟DTSR語言量化投資云培訓(xùn)RStudio學(xué)習(xí)手冊(中文翻譯)_第2頁
大智慧龍軟DTSR語言量化投資云培訓(xùn)RStudio學(xué)習(xí)手冊(中文翻譯)_第3頁
大智慧龍軟DTSR語言量化投資云培訓(xùn)RStudio學(xué)習(xí)手冊(中文翻譯)_第4頁
大智慧龍軟DTSR語言量化投資云培訓(xùn)RStudio學(xué)習(xí)手冊(中文翻譯)_第5頁
已閱讀5頁,還剩75頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、Workingg in tthe Coonsolee 控制臺中中的工作Overvieew 概述The RSttudio consoole inncludees a vvarietty of featuures iintendded too makee workking wwith RR moree prodductivve andd straaightfforwarrd. Thhis arrticlee reviiews tthese featuures. Learnning tto usee thesse feaaturess alonng witth thee relaated ffeat

2、urres avvailabble inn the HYPERLINK /docs/using/source Sourcce andd HYPERLINK /docs/using/history Histtory ppanes can hhave aa subsstantiial paayoff in yoour ovveralll prodductivvity wwith RR. RStudioo控制臺包含許許多使R工作更為有有效和直觀的的特征。本文文綜述這些特特征。學(xué)習(xí)使使用這些特征征以及 HYPERLINK /docs/using/source Sourrce和 HYPERLINK /d

3、ocs/using/history Histoory窗口中中可用的相關(guān)關(guān)特征可以對對你使用R的效率有實實際性的幫助助。Code Coomplettion 代碼補全RStudioo suppports the aautomaatic ccompleetion of coode ussing tthe Taab keyy. Forr exammple, if yoou havve an objecct nammed poollRessults in yoour woorkspaace yoou cann typee polll and then Tab annd RSttudio will aut

4、ommaticaally ccompleete thhe fulll namme of the oobjectt.RStudioo支持使用Taab鍵來自動動補全代碼。例如,如如果你在工作作空間中有名名為polllResullts的對象象,你可輸入入poll然后后按Tab鍵,RStuudio將自自動完成該對對象的全名。The codde commpletiion feeaturee alsoo provvides inlinne hellp forr funcctionss whennever possiible. For eexamplle, iff you typedd sub then p

5、resssed Taab youu woulld seee:代碼補全特征同同樣提供了盡盡可能的嵌入入式幫助。例例如,如果你你可輸入suub然后按Tabb鍵,你將看到到:Code coomplettion aalso wworks for ffunctiion arrgumennts, sso if you ttyped subseet( annd theen preessed Tab yooud ssee thhe folllowinng:代碼補全還可以以對參數(shù)功能能進行工作,如如果你可輸入入subseet(然后按按Tab鍵,你你將看到:Retrievving PPrevioous Coomm

6、andds 檢索以前命命令A(yù)s you work with R youull ooften want to ree-execcute aa commmand wwhich you pprevioously enterred. AAs witth thee stanndard R connsole, the RStuddio coonsolee suppports the aabilitty to recalll preeviouss commmands usingg the arroww keyss:當你使用R進行行工作,你將將經(jīng)??奢斎肴胫匦聢?zhí)行你你之前輸入的的命令。與標標準的R控制臺一樣樣

7、,RStuudio控制制臺支持使用用以下方向鍵鍵回憶之前命命令的功能:Up Reecall previious ccommannd(s) Down Reverrse off Up Up 回憶前前一條命令;Down 回回Up相反;If you wish to reeview a lisst of your recennt commmandss and then selecct a ccommannd froom thiis lisst youu can use CCtrl+UUp to reeview the llist (note that on thhe Macc you can aalso

8、 uuse Coommandd-Up): 如果你你希望回顧你你當前的命令令列表并從中中選擇一條命命令,則可使使用Ctrll+Up來回回顧命令列表表(注意:在在Mac你還可可使用Commmand-Up)You cann alsoo use this same keybooard sshortccut too quicckly ssearchh for commaands tthat mmatch a givven prrefix. For exampple, tto seaarch ffor prreviouus insstancees of the pplot ffunctiion siimp

9、ly type plot aand thhen Cttrl+Upp:你還可以使用同同樣的快捷鍵鍵來快速查找找匹配給定前前綴的命令。例如,查查找前面出現(xiàn)現(xiàn)過的ploot函數(shù),先先輸入ploot然后Ctrll+UpConsolee Titlle Barr 控制臺標題題欄This sccreensshot iillusttratess a feew addditionnal caapabillitiess provvided by thhe Connsole titlee bar:這個截屏闡明了了控制臺標題題欄的一些額額外功能。Displayy of tthe cuurrentt workking

10、ddirecttory. The abiility to innterruupt R durinng a llong ccomputtationn. Minimizzing aand maaximizzing tthe Coonsolee in rrelatiion too the Sourcce panne (ussing tthe buuttonss at tthe toop-rigght orr by ddoublee-cliccking the ttitle bar). 顯示當前工作目目錄;能夠在一個長期期的計算里中中斷R;最小化和最大化化Consoole和Sourcce窗口(使使用右

11、上按鈕鈕或雙擊標題題欄)Keyboarrd Shoortcutts 快捷鍵Beyond the hhistorry andd codee-comppletioon oriientedd keybboard shorttcuts descrribed abovee, theere arre a wwide vvarietty of otherr shorrtcutss avaiilablee. Somme of the mmore uusefull shorrtcutss incllude: 除了了上述的歷史史和代碼補全全快捷鍵外,還還有很多其他他快捷鍵可用用,其中最為為有用的快捷捷鍵包括Ctr

12、l+1 Movve foccus too the Sourcce Ediitor Ctrl+2 Movve foccus too the Consoole Ctrl+L Cleear thhe Connsole Esc IInterrrupt RR Ctrl+1 移動焦點到Souurce編輯輯器。Ctrl+2 移動焦點到Connsole。Ctrl+L 清理控制臺;Esc 中斷斷RYou cann findd a liist off all shorttcuts in thhe HYPERLINK /docs/using/keyboard_shortcuts Keyyboardd Shorrtc

13、utss artiicle. 你可從從 HYPERLINK /docs/using/keyboard_shortcuts Keybooard SShortccuts文中中找到所有快快捷鍵列表。Relatedd Topiics 相關(guān)主題 HYPERLINK /docs/using/source Editingg and Execuuting Code 編輯和執(zhí)行行代碼 HYPERLINK /docs/using/history Using CCommannd Hisstory 使用命令歷歷史Editingg and Execuuting Code 編輯執(zhí)行代代碼Overvieew 概述RStud

14、ioos soource editoor inccludess a vaarietyy of pproducctivitty enhhancinng feaaturess inclludingg synttax hiighligghtingg, codde commpletiion, mmultipple-fiile edditingg, andd findd/repllace.RStudioo的soucee編輯器包含含各種提高效效率的特征,包包括語法高亮亮顯示,代碼自動補補全,多文件編輯輯以及查找和和替換。RStudioo alsoo enabbles yyou too flexxibly

15、execuute R code direcctly ffrom tthe soource editoor. Foor manny R ddeveloopers this repreesentss theiir preeferreed wayy of wworkinng witth R. By exxecutiing coommandds froom witthin tthe soource editoor ratther tthan tthe coonsolee it iis mucch eassier tto repproducce seqquencees of commaands aas

16、welll as packaage thhem foor re-use aas a ffunctiion. TThese featuures aare deescribbed inn the HYPERLINK /docs/using/source#executing l executing Execuuting Code sectiion beelow.RStudioo還可以使你你直接通過soource編編輯器靈活地地執(zhí)行R代碼。對于許多R開發(fā)者來說說,這是他們們使用R的首選方式式。通過soource編編輯器執(zhí)行命命令相對于控控制臺來說更更便于復(fù)制命命令序列和將將其做為再次次使用的函數(shù)數(shù)進行

17、打包;這些特征將將在后面的執(zhí)執(zhí)行代碼部分分講解。Managinng Filles 文件管理RStudioo suppports syntaax higghlighhting and oother speciializeed codde-ediiting featuures ffor thhe folllowinng typpes off filees:Rstudioo支持語法高高亮顯示和其其他專業(yè)化的的代碼編輯功功能,針對以以下類型文件件。R scrippts R腳本文件Sweave documments Sweaave文件TeX doccumentts Tex文件To creaate a n

18、ew ffile yyou usse thee Filee - NNew meenu: 你可通過Fiile - New菜菜單創(chuàng)建新文文件。(你也也可使用Cttrl+Shhift+NN快捷鍵)。To openn an eexistiing fiile yoou usee eithher thhe Fille - Open menu or thhe Opeen Reccent mmenu tto sellect ffrom rrecenttly oppened filess. 你可通過Fille - Open菜菜單或者Openn Receent菜單選選擇來打開已已有文件。(你也可使使用Ctrll+

19、O快捷鍵)。If you open severral fiiles wwithinn RStuudio tthey aare alll avaailablle as tabs to faacilittate qquick switcching betweeen oppen doocumennts. IIf youu havee a laarge nnumberr of oopen ddocumeents yyou caan alsso navvigatee betwween tthem uusing the icoon on the ttab baar or the VView - Swiit

20、ch tto Tabb) mennu iteem:如果你通過RSStudioo打開許多文文件,那么他他們都可以通通過標簽進行行快速切換。如果你有大大量的打開文文件,你也可可在它們間通通過標簽欄中中的圖標來進進行導(dǎo)航,或或者Vieww - SSwitchh to TTab菜單項項(你也可使使用Ctrll+O快捷鍵)。Code Coomplettion 代碼補全RStudioo suppports the aautomaatic ccompleetion of coode ussing tthe Taab keyy. Forr exammple, if yoou havve an objecct

21、nammed poollRessults in yoour woorkspaace yoou cann typee polll and then Tab annd RSttudio will autommaticaally ccompleete thhe fulll namme of the oobjectt.RStudioo可以使用Taab鍵來支持持代碼自動補補全,例如,如如果你在工作作空間中有名名為polllResullts的對象象,你可輸入入poll然后后按Tab鍵,RStuudio將自自動完成該對對象的全名。Code coomplettion aalso wworks in thhe

22、connsole, and more detaiils onn usinng it can bbe fouund thhe connsole HYPERLINK /docs/using/console#completion l completion Code Complletionn docuumentaation. 代碼補全同樣在在控制臺中工工作,具體用用法可間控制制臺代碼自動動完成 HYPERLINK /docs/using/console#completion l completion Codde Commpletiion文檔。Find annd Repplace 查找和替替換RStud

23、ioo suppports findiing annd repplacinng texxt witthin ssourcee docuumentss: Rstuudio支持持在sourrce文件中中查找和替換換。Find annd repplace can bbe opeened uusing the CCtrl+FF shorrtcut key, or frrom thhe Ediit - Find and RReplacce mennu iteem.可使用Ctrll+F快捷鍵鍵來打開查找找和替換欄,或或者使用Eddit - Findd and Replaace菜單項項。Extractt F

24、uncction 提取函數(shù)數(shù)RStudioo can analyyze a selecction of coode frrom wiithin the ssourcee edittor annd auttomatiicallyy convvert iit intto a rre-usaable ffunctiion. AAny ffree variaables withiin thee seleectionn (objjects that are rrefereenced but nnot crreatedd withhin thhe sellectioon) arre connverteed

25、 intto funnctionn arguumentss:RStudioo可以在souurce編輯輯器中分析一一組選擇的代代碼,并自動動將其轉(zhuǎn)化成成再次使用的的函數(shù)。任何何選擇中的free變量(選擇引用對象象但不創(chuàng)建)將將轉(zhuǎn)化為函數(shù)數(shù)參數(shù)。(你你也可使用CCtrl+SShift+U快捷鍵)。Commentt/Uncoommentt 注釋/取消注釋You cann commment aand unncommeent enntire selecctionss of ccode uusing the EEdit - Commment/Uncommment Liness menuu itemm (y

26、ouu can also do thhis ussing tthe Cttrl+/ keybooard sshortccut):你可使用使用EEdit - Commment/Uncommment Liness菜單項來對對所選的整個個代碼進行注注釋或取消注注釋(你也可可使用Ctrrl+Shiift+C快快捷鍵)。Indentaation 首行縮進進As you writee R coode inn RStuudio iit is autommaticaally iindentted acccordiing too the curreent inndentaation optioons (ssee

27、 HYPERLINK /docs/using/customizing Cuustomiizing RStuddio). R codde is also re-inndenteed: 如果你在RSttudio中中寫R代碼,他將將自動根據(jù)當當前的縮進選選項(見 HYPERLINK /docs/using/customizing Cuustomiizing RStuddio)進行行縮進。R代碼也可再再縮進。Wheneveer neww codee is ppastedd intoo a soource documment. When thhe Reiindentt Linees commmand (

28、picttured abovee) is invokked. 當新代碼黏貼到到一個souurce文件件中;當縮進行命令(上上圖)被調(diào)用用Note thhat RSStudioo autoomaticc indeentatiion iss R syyntax-awaree and is thherefoore onnly ussed onn sourrce fiiles ccontaiining R codde.注意:RStuudio自動動縮進針對的的是R語法意識,因因此,只有在在包含R代碼的souurce文件件中使用Executiing Coode 執(zhí)行代碼碼RStudioo suppport

29、s the ddirectt execcutionn of ccode ffrom wwithinn the sourcce ediitor (the eexecutted coommandds aree inseerted into the cconsolle wheere thheir ooutputt alsoo appeears). RStuudio支持持從sourrce編輯器器中直接執(zhí)行行代碼(執(zhí)行行代碼將插入入控制臺,并并在此輸出結(jié)結(jié)果),Executiing a Singlle Linne 執(zhí)行一行行代碼To execcute tthe liine off sourrce coo

30、de whhere tthe cuursor curreently residdes yoou preess thhe Ctrrl+Entter keey (orr use the RRun tooolbarr buttton):你可通過Ctrrl+Entter鍵來執(zhí)執(zhí)行當前光標標所在行的ssourcee代碼(或者者使用Run工具條條按鈕)After eexecutting tthe liine off codee, RSttudio autommaticaally aadvancces thhe currsor tto thee nextt linee. Thiis enaables you

31、 tto sinngle-sstep tthrouggh a ssequennce off linees.執(zhí)行完一行代碼碼,RStuudio自動動將光標跳到到下一行,這這將使你可以以在一系列行行中單步執(zhí)行行代碼。Executiing Muultiplle Linnes 執(zhí)行多行行代碼There aare thhree wways tto exeecute multiiple llines from withiin thee edittor:有三種方法從編編輯器中執(zhí)行行多行代碼。Select the llines and ppress the CCtrl+EEnter key (or usse

32、thee Run tooolbarr buttton); or After eexecutting aa seleectionn of ccode, use tthe Ree-Run Previious RRegionn commaand (oor itss assoociateed tooolbar buttoon) too run the ssame sselecttion aagain. Notee thatt channges tto thee seleectionn inclludingg addiitionaal, reemovall, andd modiificattion oo

33、f linnes wiill bee refllectedd in tthis ssubseqquent run oof thee seleectionn. To run the eentiree docuument presss the Ctrl+Shiftt+Enteer keyy (or use tthe Soource toolbbar buutton). 選擇這些行,按按Ctrl+Enterr鍵(或者使使用Run工具條條按鈕)執(zhí)行選擇的代碼碼后,使用RRe-Runn Prevvious Regioon命令(或或相應(yīng)的工具具欄按鈕)再再次運行相同同的選擇。注注意:現(xiàn)在發(fā)發(fā)生變化,包包括

34、增增加、刪刪除和修改行行將反映到后后續(xù)運行中。(或或者使用Cttrl+Shhift+PP快捷鍵)運行整個文件按按Ctrl+Shiftt+Enteer鍵(或使使用sourrce工具條條按鈕)?The diffferennce beetweenn runnning llines from a sellectioon andd invooking Sourcce is that when runniing a selecction all llines are iinsertted diirectlly intto thee conssole wwhereaas forr Sourrce thhe

35、fille is savedd to aa tempporaryy locaation and tthen ssourceed intto thee conssole ffrom tthere (therreby ccreatiing leess cllutterr in tthe coonsolee).從選擇的行進行行運行和調(diào)用用Sourcce的區(qū)別在在于,當運行行所選的所有有行將直接插插入到控制臺臺中,而對于于Sourcce文件則保保存到臨時位位置然后從那那里反映到控控制臺(因此此在控制臺中中產(chǎn)生較少的的雜亂)。Source on Saave 資源保存When edditingg re-u

36、usablee funcctionss (as oppossed too freeestandding llines of R) you may wwish tto sett the Sourcce on Save optioon forr the documment (availlable on thhe tooolbar next to thhe Savve icoon). EEnabliing thhis opption will causee the file to auutomatticallly be sourcced innto thhe gloobal eenviroonmen

37、tt everry timme it is saaved.當編輯一個再次次調(diào)用函數(shù)(相相對于獨立的的R行而言),你你可能希望對對文件設(shè)置SSourcee on SSave選項項(通過工具具條中Savve圖標的后后一項實現(xiàn))。啟用該選項導(dǎo)致文件每次保存都將被全球自動采用。Settingg Sourrce onn Savee ensuures tthat tthe coopy off a fuunctioon witthin tthe gllobal envirronmennt is alwayys in sync with its ssourcee, andd alsoo provvides a

38、 goood wayy to aarrangge forr freqquent syntaax cheeckingg as yyou deevelopp a fuunctioon.設(shè)置Sourcce on Save選選項確保該函函數(shù)的版本在在全球環(huán)境總總是能夠資源源同步,并且且也能在你開開發(fā)一個函數(shù)數(shù)是提供一種種好的方式安安排頻繁的語語法檢查。Keyboarrd Shoortcutts 快捷鍵Beyond the kkeyboaard shhortcuuts deescribbed abbove, theree are a widde varriety of otther sshortccut

39、s aavailaable. Some of thhe morre useeful oones iincludde:除了上述的快捷捷鍵外,還有有很多其他快快捷鍵可用,其其中最為有用用的快捷鍵包包括。Ctrl+Shhift+NN Neew doccumentt 新文檔Ctrl+O Opeen doccumentt 打開文檔Ctrl+S Savve acttive ddocumeent 保存活動文文檔Ctrl+1 Movve foccus too the Sourcce Ediitor 移動焦點到Souurce編輯輯器Ctrl+2 Movve foccus too the Consoole 移動焦

40、點到控制臺臺You cann findd a liist off all shorttcuts in thhe HYPERLINK /docs/using/keyboard_shortcuts Keyyboardd Shorrtcutss artiicle. Relatedd Topiics 相關(guān)主題題 HYPERLINK /docs/using/console Workingg in tthe Coonsolee 在控制臺臺中工作 HYPERLINK /docs/using/history Using CCommannd Hisstory 使用歷史史命令 HYPERLINK /docs/us

41、ing/navigation Navigatting CCode 代碼導(dǎo)航 HYPERLINK /docs/using/code_folding Code Fooldingg and Sectiions 代碼折疊和截取 Code Fooldingg and Sectiions 代碼折疊和和截取Code Fooldingg 代碼折疊疊RStudioo suppports both autommatic and uuser-ddefineed follding for rregionns of code. Codee foldding aallowss you to eaasily show an

42、d hhide bblockss of ccode tto makke it easieer to naviggate yyour ssourcee filee and focuss on tthe cooding task at haand. FFor exxamplee, in the ffollowwing ssourcee filee the body of thhe ploot.auttoregrressivve.moddel haas beeen follded: RStudioo支持自動和和使用者定義義的地區(qū)代碼碼折疊。代碼折疊允允許你很方便便地顯示和隱隱藏代碼塊,這這將使你的s

43、sourcee文件導(dǎo)航更更簡易,并可可以將中重點點放在手頭的的代碼任務(wù)上上。例如,在在下面的soource文文件中ploot.auttoregrressivve.moddel部分已已經(jīng)被折疊。You cann expaand thhe follded rregionn by eeitherr cliccking on thhe arrrow inn the gutteer or on thhe icoon thaat oveerlayss the foldeed codde. 你可展開折疊部部分,通過點點擊箭頭槽或或者覆蓋折疊疊代碼的圖標標。Foldablle Reggions 折疊區(qū)域域Th

44、e folllowinng typpes off codee regiions aare auutomatticallly folldablee withhin RSStudioo: RStudioo中以下類型型的代碼區(qū)域域?qū)⒆詣诱郫B疊:Braced regioons (ffunctiion deefinittions, condditionnal bllocks, etc.) Code chhunks withiin R SSweavee or RR Markkdown documments Code seectionns (seee bellow foor dettails) 支撐區(qū)域(函

45、數(shù)數(shù)定義、條件件塊等)R Sweavve的代碼塊塊或者是R的Markddown文件件。代碼段(具體見見后文)In the folloowing exampple yoou cann see that the ttop-leevel ccode ssectioon, fuunctioon boddy, annd connditioonal bblockss are all ffoldabble: 在以下案例中,即即將看到頂級級代碼部分、函函數(shù)體和條件件塊都被折疊疊。You cann alsoo foldd an aarbitrrary sselecttion oof codde by using

46、g Editt - FFoldinng - Collaapse (Alt-LL). 你也可折疊任意意選定的代碼碼,通過Eddit - Foldding - Colllapsee,或者使用用Alt-LL快捷鍵。Folded regioons arre preeserveed whiile edditingg a doocumennt howwever when a fille is closeed andd re-oopenedd all foldaable rregionns aree by ddefaullt shoown exxpandeed. 折疊部分在編輯輯文件時將被被保證,但是是當文

47、件關(guān)閉閉或者再次打打開時,所有有折疊部分將將默認展開顯顯示。Code Seectionns 代碼段Code seectionns alllow yoou to breakk a laarger sourcce fille intto a sset off disccrete regioons foor eassy navvigatiion beetweenn themm. Codde secctionss are autommaticaally ffoldabblefoor exaample, the folloowing sourcce fille hass threee secctions

48、s (onee expaanded and tthe otther ttwo foolded): 代碼段允許你將將一個大型的的sourcce文件分解解成一組獨立立的區(qū)域以方方便再他們之之間漫游。代代碼段將自動折疊疊,例如,以以下源文件有有三個部分(一一個展開而另另兩個折疊)。To inseert a new ccode ssectioon youu can use tthe Coode - Inseert Seectionn commaand. AAlternnativeely, aany coommentt linee whicch inccludess at lleast four tra

49、illing ddashess (-), equaal siggns (=), orr pounnd siggns (#) auttomatiicallyy creaates aa codee secttion. For eexamplle, alll of the ffollowwing llines creatte codde secctionss: 插入一個新的代代碼段你使用用Code - Inssert SSectioon命令?;蚧蛘?,任意注注釋行中包含含至少四個破破折號(-),等號(=)或井號(#)將自動創(chuàng)創(chuàng)建代碼段。 # Secttion OOne # Secttion TTwo

50、= # Seectionn Threee # Note thhat ass illuustratted abbove tthe liine caan staart anny nummber oof pouund siigns (#) soo longg as iit endds witth fouur or more -, =, or # charracterrs. 注意:如前所述述,可輸入超超過4個或更多的的數(shù)量的#號,-,=等。To naviigate betweeen coode seectionns youu can use tthe Juump Too menuu avaiilabl

51、ee at tthe boottom of thhe ediitor: 你可使用編輯器器低端的Juump Too菜單在代碼段段間漫游(或或者使用Allt+Shiftt+J快捷鍵)。Menu Coommandds andd Shorrtcutss 菜單命令和和快捷鍵The folllowinng mennu commmandss and shorttcuts are aavailaable ffor woorkingg withh foldded reegionss and code sectiions: 以下菜單命令和和快捷鍵可以以對折疊區(qū)域域和代碼段進進行操作:Edit - Foldding

52、: Collapsse AAlt+L Expand Shiift+Allt+L Collapsse Alll Allt+A Expand All Shifft+Altt+A Code: Insert Sectiion Ctrl+Shiftt+R (CCmd+Shhift+RR on tthe Maac) Jump Too Shhift+AAlt+J Note thhat thhe Colllapsee All commaand coollapsses alll of the ooutermmost ffoldabble reegionss (ratther tthan aall off the

53、 nesteed reggions withiin thee sourrce fiile). 注意:Colllapsee All命命令折疊所有有外層可折疊疊區(qū)域(而不不是源文件中中的所有嵌套套區(qū)域)Relatedd Topiics HYPERLINK /docs/server/navigation Navigatting CCode 導(dǎo)航代碼碼 HYPERLINK /docs/server/source Editingg and Execuuting Code 編輯和執(zhí)行行代碼Navigatting CCode 導(dǎo)航代碼RStudioo inclludes a nummber oof feaa

54、turess to eenablee rapiid navvigatiion thhroughh R soource code. Learrning thesee feattures can bbe a mmajor produuctiviity ennhanceement and ccan allso asssist in gaainingg a beetter underrstandding oof souurce ccode wwritteen by otherrs on your team or wiithin exterrnal ppackagges.RStudioo包括一些在在R源

55、代碼中加加速導(dǎo)航的功功能。學(xué)習(xí)這這些功能可以以提高效率并并幫助更好地地理解你的團團隊中其他人人所寫的源代代碼,或者是是外部程序包包中的源代碼碼。Find inn Filees 查找文件Given aa speccific direcctory, Findd in FFiles allowws youu to rrecurssivelyy searrch evvery ffile ffor eaach occcurreence oof a ggiven strinng. Too dispplay tthe Fiind inn Filees diaalog bbox, ggo to the eed

56、it mmenu aand seelect Find in Fiiles: 給出一一個特定目錄錄,查找文件件(Edit-Findd in FFiles)允許你對每每個出現(xiàn)的字字符串遞歸查查找每一個文文件。顯示查查找文件對話話框,編輯菜菜單并選擇查查找文件:You cann furtther ccustommize yyour ssearchh withh reguular eexpresssionss and filteers foor speecificc filee typees. Yoour seearch resullts wiill diisplayy in tthe paane a

57、ddjacennt to the cconsolle. Foor eacch mattchingg striing, tthe foollowiing wiill bee dispplayedd: 你可以以進一步通過過正式表達式式和特定文件件類型來自定定義你的搜索索。你的搜索索結(jié)果將顯示示在控制臺的的相鄰窗口中中。每一個匹匹配的字符串串都將顯示以以下信息:The fille patth 文件路徑徑The linne nummber oof eacch occcurrennce 每個出現(xiàn)的的行號The mattchingg striing (hhighliightedd), inn the co

58、nteext off the curreent liine 當前行內(nèi)容中匹匹配的字符串串(高亮)Double clickking tthe liine, wwill oopen tthe fiile inn the RStuddio soource editoor. Thhe keyyboardd shorrtcut for FFind iin Filles iss Ctrll+Shifft+F 雙擊這這一行,將在在RStuddio的sourcce編輯器中中打開該文件件。查找文件件的快捷鍵是是Ctrl+Shiftt+F。Go to FFile/FFunctiion 轉(zhuǎn)到文件件/函數(shù)If you

59、 know the nname oof thee sourrce fiile orr funcction that you wwant tto ediit nexxt youu can quickkly naavigatte to it ussing tthe Goo to FFile/FFunctiion seearch box oon thee mainn RStuudio ttoolbaar: 如果果你知道源文文件或函數(shù)的的名字并想對對其進行編輯輯,你可以使使用RStuudio工具具條中的Goo to FFile/FFunctiion搜索框框迅速導(dǎo)航。The Go to Fiile/Fu

60、unctioon feaature workss off a connstanttly uppdatedd indeex of your sourcce codde. Thhe speecificc sourrce fiiles tto inddex arre detterminned ass folllows: Go to Fiile/Fuunctioon功能就不不斷更新索引引你的源代碼碼。專業(yè)源文文件的索引將將決定于:If an HYPERLINK /docs/using/projects RRStudiio Prooject is acctive then all RR sourrce

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論