Home
paper
Contents
1. WinEdt Its interface to R will be dis cussed as well as possible changes and improvements Further on it will be dis cussed whether it is desirable to have full support of Sweave Leisch 2002 which provides convenient state of the art literate statistical analysis with R 2 Why WinEdt The recommended editor for writing R code is the Emacs Stallmann 1999 with its ESS interface Emacs Speaks Statistics Rossini Heiberger Sparapani Machler Thttp CRAN R Project org contrib extra winedt 2http www WinEdt com 3 Windows is a trademark of the Microsoft Corporation Proceedings of DSC 2003 2 A WinEdt D uwe T agungen DSC 2003 Paper RWinE dt tex G Eile Edit Search Project Insert Tools Macros Accessories Options Window Help l x BOS6U oo VA HAAHED oB E m 2 Shs Ba AR HAT R TX hy Bix ARR we ey RiwinEdt tex ligges bib literate statistical analysis with R section Why WinEdt label sec why The recommended editor for writing R code is the Emacs citep ste with its ESS interface citep emph Emacs Speaks Statistics rc In the R manuals there is a remark on ESS in cite r intro170 and an entire Section devoted to R and Emacs can be found in cit In my experience many textsf Windows users feel uncomfortable witk This was indeed the initial occasion for writing RU At the time of writing this article John Fox is working on some
2. beta Many R functions at the same time in the same editor Buttons Shortcuts for simple access one click to Save document and source into R Submit script to R WinEdt as scripting window Paste selected code from WinEdt directly to R e g from history or just evaluate the current line Open and update Rhistory so you can reuse your last commands Templates e g for _ in _ _ Faster starting than with standard configuration of WinEdt Features of WinEdt e g Delimiter Check advanced searching bookmarks macros Independent of another WinEdt running with LaTeX configuration Works with RGui running in MDI or SDI style and also with S PLUS not supported Installation Install R rw1020 or later Install WinEdt 5 V 5 2 Build 20001213 or later Note WinEdt is Shareware http www WinEdt com Now there are two ways the first one a is recommended a Installation as an R package Install the Omegahat package SWinRegistry required available at http www Omegahat org SWinRegistry At the time of writing SWinRegistry_0 3 1_binary zip is current The R GUI can be used Proceedings of DSC 2003 9 Packages gt Install package s from local zip files Install this archive RWinFdt_ zip The R GUI can be used Packages gt Install package s from local zip files All further steps will be done automatically by typing gt library RW
3. insert templates into the current document of WinEdt One can jump from one missing entry marked with in the examples below to the other in order to fill in by pressing Ctrl Space For each of the marked items there are two macros One macro submits information to R and goes back to WinEdt at once e g in order to submit several discontinued regions of code whereas the other one is intended to change the focus permanently to R after submission Copy and paste a selected region of code Copy and paste the current line Save and source the whole file e Save the R history in file Rhistory and open it in R WinEdt e Insert function template function J e Insert loop template for e Insert if template if J e Insert ifelse template if elsef Proceedings of DSC 2003 6 Syntax Highlighting FY XK TL SBR BS es n A Fiter Sets Switches Reserved Words Columns Reserved Words Filters Font R compare Before rAlpha z IV Default Font I After Alpha 7 T Italic R for if else while R lt I Bold me T Underline Vv Enabled TO Strikeout F Priority 0 9 E Colo I Default Color Jv Default Backaround I Case Sensitive Sme Gia JReservea Word Figure 3 R WinEdt configuring the highlighting scheme 3 2 Highlighting Setting up highlighting schemes is
4. Gui is minimized it is not possible to interact with it For a discussion whether it is desirable to improve the interface see Section 4 The question arises what kind of information can be pasted into the R session Two examples are given the first one shows a macro that pastes a selected region of R code from R WinEdt both shortcuts and icons can be set up to invoke macros CMD Copy copy selected text into a buffer ReplaceInString 1 gt 0 1 1 9 add a newline at the end CopyToClipboard 9 1 copy buffer into the clipboard LetReg 9 clear the buffer Exe b send2R edt execute the main interface End The second example shows a macro that saves the current file and source s it into R CMD Save save the current file GetChildName 9 save the path filename into buffer1 DosToUnix 9 8 translate to in buffer1 copy a newline in buffer2 ReplaceInString 1 gt 0 1 1 9 copy source buffer1 buffer2 into the clipboard CopyToClipboard source 4 8 9 0 LetReg 9 clean up buffers 1 and 2 LetReg 8 Exe b send2R edt execute the main interface End For details on WinEdt s macro language I refer to its manual and the two ver sions of The WinEdt Hacker s Guide by Alexander and Marquardt 1998 and Alexander 1999 A complete list of all available macros is given below The template macros
5. New URL http www R project org conferences DSC 2003 Proceedings of the 3rd International Workshop on Distributed Statistical Computing DSC 2003 March 20 22 Vienna Austria ISSN 1609 395X Kurt Hornik Friedrich Leisch amp Achim Zeileis eds http www ci tuwien ac at Conferences DSC 2003 R WinEdt Uwe Ligges Abstract In the first part of this paper the status quo of R WinEdt a plug in for the shareware editor WinEdt for Windows is described This description includes the interface between R and WinEdt convenient editing features like syntax highlighting and the installation procedure The second part is aimed at the future of R WinEdt Is it desirable to improve the plug in Possible improvements related to the interface and integration of Sweave functionality are discussed 1 Introduction R WinEdt is a plug in for WinEdt a shareware editor for the operating system Windows It provides an interface to R Ihaka and Gentleman 1996 a statisti cal programming language and environment Additionally a highlighting scheme which illuminates the syntactical structure of the R code replaces WinEdt s de faults Shortcuts menus and toolbar buttons are included to provide easy access to common operations for the user s convenience The existing functionality will be presented in Section 3 just after some comments why WinEdt is the editor of my choice in Section 2 Section 4 is aimed at the future of R
6. Windows like features for ESS for details see url http www socsci memaster ca jfox Books Compar X a E EEA E EER AE NENT BEN TE ANOO T AE EEN ne ne EEA E ET EE 2 531 118 Wrap indent INS LINE Spell TeX Mo 3 7 Figure 1 WinEdt in its regular TEX mode and Hornik 2003 In the R manuals there is a remark on ESS in Venables Smith and the R Development Core Team 2003 and an entire Section devoted to R and Emacs can be found in Hornik 2003 In my experience many Windows users feel uncomfortable with the Emacs This was indeed the initial occasion for writing R WinEdt WinEdt is a very powerful and flexible editor focused on IATRX and it is widely known among IATRX users under Windows see Figure 1 for a screenshot It is easy to define Task Bars Menus and quite sophisticated highlighting schemes in WinEdt The editor also provides an extended Macro language that includes e g capabilities for interaction with the operating system There are convenient ways to automate tasks in WinEdt using this macro language the Linux user typically uses a Makefile instead For details I refer to the WinEdt manuals Because of all these features it was easy to implement the simple plug in in its current version Unfortunately WinEdt is a commercial affordable shareware editor hence I have no access to its sources So it is necessary to convince WinEdt s author Aleksander Simonic in order to ge
7. a 2001 Technische Universitat Wien URL http www ci tuwien ac at Conferences DSC 2001 Proceedings A Rossini Literate Statistical Analysis In Kurt Hornik and Friedrich Leisch editors Proceedings of the 2nd International Workshop on Distributed Statistical Computing March 15 17 Vienna 2001 Technische Universitat Wien URL http www ci tuwien ac at Conferences DSC 2001 Proceedings A Rossini R M Heiberger R Sparapani M Machler and K Hornik Emacs Speaks Statistics a multi platform multi package development environment for statistical analysis Journal of Computational and Graphical Statistics 2003 Forthcoming R M Stallmann The Emacs Editor Boston 1999 URL http www gnu org Version 20 7 W N Venables D M Smith and the R Development Core Team An Introduc tion to R Version 1 7 0 R Project 2003 URL http CRAN R project org manuals html Affiliation Uwe Ligges SFB 475 Reduction of Complexity for Multivariate Data Structures Fachbereich Statistik Universitat Dortmund Germany E mail ligges statistik uni dortmund de
8. easy in WinEdt and corresponding rules are highly configurable cf Figure 3 The very complete R WinEdt highlighting scheme distinguishes between the following main groups of highlighting classes given in descending order e Comments and all stuff thereafter e Assignment operators lt lt lt gt and e Control structure keywords if else ifelse while for break repeat next e Logical operators lt gt lt gt amp amp amp II e function library require e Special values NULL NA NaN Inf F T FALSE TRUE and the functions Internal and C e Matrix operators 74 h h h h hinh Loh hXh e Contents within quotes and double quotes e Extraction of list and slot elements e Parenthesis brackets and braces 0 e A list of known R functions currently those implemented in all shipped and recommended packages e Content within brackets in library content require content Proceedings of DSC 2003 7 3 3 Auto completion A Command Completion Wizard by Holger Danielsson for WinEdt is available at http www WinEdt org Plugins complete php The wizard is quite easy to use but not yet integrated into R WinEdt mainly because I do not know anything about its licensing 4 The future Aiming at the future of R WinEdt Is it desirable to improve the plug in From my point of view it should be redesigned in order to get Sweave su
9. he Menu e g R gt Set R sdi mode To invoke R WinEdt from startmenu or desktop create a shortcut to WinEdt as follows c program files winedt team winedt winedt C R WinEdt e r ini In R use something like for example in your Rprofile options editor c program files winedt team winedt winedt c R WinEdt edit e r ini V options pager c program files winedt team winedt winedt C R WinEdt e r ini V Used WinEdt parameters There is a difference between c and C c name New instance of WinEdt called name will be started C name If an instance name of WinEdt is already running it will be used So you can run WinEdt as LaTeX and R editor at the same time Proceedings of DSC 2003 10 e name Using name as initialization file V Running in virgin mode Examples HHHHHH Recommended procedure Open WinEdt with something like c program files winedt team winedt winedt C R WinEdt e r ini i e ideally the shortcut you have already created Then create a new document and write an R function Click on the symbol R source or press ALT S You will be asked to specify a filename e g R progi R If RGui is running it will be focussed and source will be called HHHHHH options pager c program files winedt team winedt winedt C R WinEdt e r ini V file show Rhistory Mark some lines click the R paste button or use Alt P a
10. inEdt in the R Console R WinEdt will be started and an additional menu R WinEdt will be created If you are running RGui in multiple windows style MDI the default mode should be unchanged For RGui in single window style SDI or if you want to use R WinEdt with S PLUS you can change the R WinEdt mode permanently using the Menu e g R gt Set R sdi mode Examples HHHHHH Recommended procedure Load the package library RWinEdt within R Then create a new document and write an R function Click on the symbol R source or press ALT S You will be asked to specify a filename e g R progi R If RGui is running it will be focussed and source will be called HHHHHT file show Rhistory Mark some lines click the R paste button or use Alt P as shortcut Marked lines will be executed in RGui HHHHHH The following way to edit function is possible but not recommended my legend lt legend fix my legend b Alternative Manual installation procedure Unzip the archive and copy the sub directory PlugIn into directory winedt plugins e g c program files winedt team winedt plugins PlugIn In your Windows Explorer double click on install bat If you are running RGui in multiple windows style MDI the default mode should be unchanged For RGui in single window style SDI or if you want to use R WinEdt with S PLUS you can change the R WinEdt mode permanently using t
11. nd memory consumption Today that is no longer a problem to worry about so a redesigned plug in could easily provide a combined interface The only issue to think about is the configuration of an adequate highlighting scheme for combined documents such as Sweave files Thus highlighting must be sensitive to code chunks in a way And of course an installation should not corrupt users adaptions 9 dani fbg schwerte de he seems to be disappeared 10Sweave combines typesetting with IATFX and statistical data analysis with R into integrated statistical documents Proceedings of DSC 2003 8 5 Conclusion The recent version of R WinEdt provides the Windows way of editing R code convenient flexible and powerful but it is not quite as powerful as ESS for the Emacs I think the plug in should be redesigned in order to implement Sweave support whereas the implementation of a better interface is of less priority I would like to invite the reader to submit contributions and other suggestions to any of these topics Appendix Readme txt Overview Using WinEdt as an editor for R only Rgui under Windows Features Syntax Highlighting and highlighted printing function index of all recommended packages including base boot class cluster ctest eda foreign grid KernSmooth lattice lqs MASS methods mgcv modreg mva nlme nls nnet rpart spatial splines stepfun survival tcltk tools ts last update 13 09 2002 R 1 6 0
12. pport Section 4 2 For the computer scientist s point of view the interface needs to be redesigned as well but not for me being mainly an user 4 1 Interface In Section 3 1 the awkward recent interface which works surprisingly stable ex cept for the RGui is minimized bug has been described Three ways of improved interfaces can be considered e Convincing WinEdt s author to integrate DCOM support e Writing a DDE interface for R e Using socket connections For me the current interface works stable enough so I will not make much effort Benefits of possible improvements have to be compared to all the work that is required to implement these improvements Nevertheless contributions will be highly appreciated 4 2 Sweave Since WinEdt is focused on ATEX it seems to be natural to combine this TEX func tionality with the capabilities of the R WinEdt plug in Literate statistical analysis for a discussion related to ESS see Rossini 2001 with R would benefit from combin ing those capabilities More specifically full support of Sweave by Leisch 2002 is desirable for convenient state of the art literate statistical analysis with R R WinEdt was initially written on a Pentium I machine 133MHz 64MB RAM Windows NT 4 0 where speed and memory efficiency was still an issue Unfor tunately it was not possible to combine both R and TFX functionality without getting a big penalty in WinEdt s starting times a
13. s a Section title which implies more than what has been implemented On the one hand unfortunately WinEdt does not support DCOM but uses DDE instead I was not able to convince WinEdt s author to implement DCOM support in WinEdt On the other hand there is a DCOM server Neuwirth and Baier 2001 for R available but no DDE interface Shttp www Omegahat org pcom Distributed Component Object Model 8ppE Dynamic Data Exchange basic technology of Microsoft s OLE Object Linking and Em bedding Proceedings of DSC 2003 4 What I did instead is making use of some features of WinEdt s macro language in the following manner When any information has to be send to R it is constructed by the macro language Then it is copied to the Windows clipboard and pasted into the R Console window of RGui using the following macro which implements the awkward main part of the interface SetFocus RGui set focus to R PostMessage RGui 0104 12 20000001 press ALT Wait 150 RGui needs some time PostMessage RGui 0105 12 20000001 release ALT PostMessage RGui 0102 87 1 Char W gt Win Menu PostMessage RGui 0102 49 1 Char 1 gt Window1 R Console Wait 150 RGui needs some time PostMessage RGui 0104 12 20000001 press ALT PostMessage RGui 0105 12 20000001 release ALT PostMessage RGui 0102 69 1 Char E gt Edit Menu PostMes
14. s data frame xyz c x e lt Ctrl xlim ylim zlim select the points i Set R mdi mode default if is nuli xlim Set R sdi mode xlim lt range xlim Set S Plus mode bugs dat lt dat xlim 1 lt datSx amp dat x lt if is null ylim ylim lt range ylim dat lt dat ylim 1 lt datSy amp datSy lt ylim 2 drop FALSE M gt Em iE De Wrap Indent INS LINE Spell R Mo 3 Mrz 20C 7 Figure 2 WinEdt running with the R WinEdt plug in The recent version 1 5 0 at the time of writing of R WinEdt works with WinEdt 5 2 and later on any 32 bit version of Windows and requires R 1 2 0 or later Of course any version numbers are subject to change In its most recent version R WinEdt is shipped in form of a binary package for R for Windows which requires for an automatical installation procedure Duncan Temple Lang s SWinRegistry package of The Omega Project for Statistical Computing in order to perform required tasks related to the Windows registry I received quite a lot questions related to the former but still available manual installation procedure of R WinEdt which indeed was uncommon in a way because there was just a simple file install bat that had to be invoked in the exactly correct directory For detailed installation instructions see R WinEdt s edited ReadMe txt file in the Appendix 3 1 Interface Interface i
15. s shortcut Marked lines will be executed in RGui HHHHHT The following way to edit function is possible but not recommended options editor c program files winedt team winedt winedt c R WinEdt edit e r ini V my legend lt legend fix my legend Known bugs If RGui is minimized it is impossible to send commands from WinEdt to RGui Workaround Don t minimize RGui Works in S PLUS mode only if the command window is opened as window 1 Doesn t work with all versions of S PLUS tested with version 4 5 References J Alexander The WinEdt Hacker s Guide 11 1999 URL http www WinEdt org J Alexander and C Marquardt The WinEdt Hacker s Guide 11 1998 URL http www WinEdt com K Hornik The R FAQ Version 1 7 3 R Project 2003 URL http CRAN R project org manuals html R Ihaka and R Gentleman R A Language for Data Analysis and Graphics Journal of Computational and Graphical Statistics 5 3 299 314 1996 F Leisch Sweave User Manual Institut fiir Statistik und Wahrscheinlichkeit stheorie Technische Universit t Wien Vienna Austria 2002 URL http wiw ci tuwien ac at leisch Sweave R Version 1 6 0 E Neuwirth and T Baier Embedding R in Standard Software and the other way round In Kurt Hornik and Friedrich Leisch editors Proceedings of the 2nd International Workshop on Distributed Statistical Computing March 15 17 Proceedings of DSC 2003 11 Vienn
16. sage RGui 0102 80 1 Char P gt Paste So this main part can be described as follows After the focus of programs is switched from WinEdt to R and both applications have been started of course key presses are simulated in a manner like one would use the menu without any mouse 1 Press Alt 2 RGui and Windows needs some time to open the menu time depends of the operating system it takes most time on Windows XP 3 Release Alt 4 Press W opens the menu called Windows 5 Press 1 selects window 1 which is identical to the R Console now we are sure to have focussed the R Console instead of e g an R Graphics window Again some time is needed to switch to the R Console window Press and release Alt to open the menu again Press E to open the Edit menu and So Oe a G3 press P to Paste the contents of the clipboard into the R Console window This macro code is written for working with RGui running in mdi mode a version working with RGui s sdi mode is somewhat simpler SetFocus R Console Wait 150 PostMessage R Console 0104 12 20000001 Wait 150 PostMessage R Console 0105 12 20000001 PostMessage R Console 0102 69 1 PostMessage R Console 0102 80 1 Proceedings of DSC 2003 5 Obviously the interface is an awkward one but it is extremely simple with just 11 7 lines of macro code There is one bug in this macro If R
17. t desirable new features into the editor 3 Status quo The most easiest way to get to know the current state of R WinEdt is to try it out and play around Nevertheless in this Section R WinEdt s status quo and some corresponding technicalities will be described See Figure 2 for a screenshot of R WinEdt in action 4 At the time of writing this article John Fox is working on some Windows like features for ESS For details see http www socsci mcmaster ca jfox Books Companion ESS 5alex winedt com Proceedings of DSC 2003 3 R WinE dt D uwe R Mibrary devel scatterplot3d R scatterplot3d R 5 File Edit Format Search Insert Tools Options Window Help EW e RO R history update Alt H D a Wi B o gt A m BB Re Be BP Atoy tupda PASTE Feline and go AlteL scatterplot3d R erp Rhistory RE CirledlteL yz f lt scale y abs if angle lt 1 angle Re Aepaste andlag AltsP yx f lt scale y if angle lt 2 1 angle pe R pa ChieBleP if angle gt 2 i switch y and x axis to R Fe d AlteS temp lt xyzSx xyzSx lt xyzSy xyzSy lt i z temp lt xlab xlab lt ylab ylab lt R B seript Ctrl Alt S temp lt xlim xlim lt ylim ylim lt gt function Ctrl Alt F gt for Ctrl Alt 0 angle 1 lt ifelse 2 gt angle amp amp angle gt 1 gt if CtrlsAlt angle 2 lt ifelse i gt angle angle gt 3 gt if a ClrleAlteK dat lt chind a
Download Pdf Manuals
Related Search
Related Contents
Manual de instalação indicadores FULL COLOR Samsung Galaxy Note 3 Felhasználói kézikönyv(Kitkat) User Manual Legion Meter USB Gardena 01411-20 Structured Cable Products apple User's Manual HERMA Labels Premium A4 38.1x21.2 mm white paper matt 650 pcs. Geschirrspüler Copyright © All rights reserved.
Failed to retrieve file