[R-SIG-Mac] R in terminal
Phillip Price
pnprice at lbl.gov
Sat Jun 28 00:11:12 MEST 2003
On Friday, June 27, 2003, at 09:02 PM, Jan de Leeuw wrote:
> This is the #1 FAQ. Say. in the terminal,
>
> cd /usr/local/bin; ./R
>
> or say
>
> /usr/local/bin/R
>
> In order to just say R, /usr/local/bin must be in your PATH. To
> make sure that it is, put
>
> setenv PATH /usr/local/bin:{$PATH}
>
> in your ~/.tcshrc.
>
> If any of the above is not clear, I strongly suggest
>
> Taylor and Peek: Unix for Mac OS X, O'Reilly, 2002.
>
> Every piece of Unix you learn will make your OS X experience better.
Matthew, here's a 2-minute primer to help you make sense of the above.
When you give a command in unix, the system looks in a set of
directories called your "path" in order to find the command. FIrst it
checks the first directory that is listed in your path; if the command
isn't there, it checks the second directory; and so on.
Usually, people put their commands (that is, their executable programs)
in only a few places (just as people usually put all of their non-unixy
applications in the /Applications folder), so once you've got your path
set up, you usually don't have to mess with it much.
You can find out your current path by typing "echo $path" at the
command line.
The command Jan gave, "setenv PATH /usr/local/bin:{$PATH}" sets your
PATH environment variable to be whatever it was before, prepended by
the directory "/usr/local/bin", which is where the installer put the R
executable. If you type this command, you can then type "R" and the
system will look in /usr/local/bin and run the R executable.
If you put this command in a file called ".tcshrc" in your home
directory, you won't have to mess with it again: that file gets
executed automatically when you turn on your computer. If you just
add the command to your .tcshrc file, but don't want to bother turning
off the computer and turning it back on (actually, just logging out and
logging back in would be enough), you can add the command to .tcshrc
and then type "source .tcshrc".
There is a complication, though: as far as I know, you can't "see" any
file whose name starts with a "." in the Finder window, or in "Open"
dialog boxes, so how can you edit it? (There's certainly some
shareware to turn this off and on, but I don't see a way within the OS
itself). I think that to create and/or edit a .tcshrc file, you'll
need to learn one of the unix-style editors that comes with OS X.
("emacs" and "vi" are by far the most widely used. I prefer emacs).
By the way, make sure you're using the "X11" program (available from
the Apple website) to run R, not the Terminal application.
If all of this sounds daunting: it shouldn't. Or maybe it should, but
don't let it daunt you. Unix is a joy to work with, and if you learn a
few unix tools and commands it will make your life as a scientist much
more pleasant.
Or, you can wait until the fledgling Aqua version of R is a little more
mature---at the rate it's coming along, it should be usable very soon.
Then you won't have to use unix at all....but that'll be your loss.
Good luck.
--Phil Price
>
>
> On Friday, Jun 27, 2003, at 19:44 US/Pacific, Matthew James Krachey
> wrote:
>
>> Hi everybody. I am trying to use R in order to run an ordinal
>> regression. I
>> purchased Harrell's Regression Modeling Strategies text and am trying
>> to get
>> the Design library to work.
>>
>> After multiple issues with the earlier versions (1.5.1, 1.6.2) being
>> able to
>> run the Design library, I've decided to try the Darwin versions
>> (1.7.0,
>> 1.7.1). I downloaded the installer packages from Jan de Leeuw's page
>> and
>> installed. Now when I'm in the terminal window, when I enter "R" to
>> invoke
>> the program, or "R CMD" as it says in the man page, I get a R doesn't
>> exist
>> error, but the man page for R exists.
>>
>> Any advice for a Unix neophyte? This experience has been quite
>> underwhelming. Any help is much appreciated
>>
>> Matthew Krachey
>> M.S. Candidate
>> Department of Fisheries Biology
>> Humboldt State University
>> Arcata, California
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
> ===
> Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
> Editor: Journal of Multivariate Analysis, Journal of Statistical
> Software
> US mail: 9432 Boelter Hall, Box 951554, Los Angeles, CA 90095-1554
> phone (310)-825-9550; fax (310)-206-5658; email:
> deleeuw at stat.ucla.edu
> homepage: http://gifi.stat.ucla.edu
>
> -----------------------------------------------------------------------
> --------------------------
> No matter where you go, there you are. --- Buckaroo Banzai
> http://gifi.stat.ucla.edu/sounds/nomatter.au
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list