[R] calling an editor on MAC and Linux

Martin Maechler maechler at stat.math.ethz.ch
Fri Jun 14 11:22:19 CEST 2002


>>>>> "Niels" == Niels Waller <niels.waller at vanderbilt.edu> writes:
>>>>> "Niels" == Niels Waller <niels.waller at vanderbilt.edu> writes:

    Niels> I have written an R function that writes output to an
    Niels> external file using the sink function.  I assume that
    Niels> `sink' is not operating system dependent.  At the end
    Niels> of the function I have additional code that opens the
    Niels> newly created file using notepad on a Windows system.
    Niels> Obviously, this part of the code will not work on a
    Niels> Mac or Linux box.  Since I do not have a machine with
    Niels> Linux or the Mac OS available I have no idea what to
    Niels> call the default editors.  Could somebody provide a
    Niels> suggestion?  Thanks in advance.

    Niels> win3 <- function(...) {
    Niels> system(...)
    Niels> }

    Niels> [a zillion lines of code here ]


    Niels> notepad.file <- paste("notepad", outFile, sep = " ")
    Niels> win3(notepad.file)


Excuse me for not chiming in earlier.
There is the ``only one correct'' (:-) solution of using

 getOption("editor")

where it's assumed the user (or installer or OS default) has
properly set
	 options(editor = " ....")

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list