[R] Get home directory and simple I/O

2007-03-23 Thread Alberto Monteiro
Is there any generic function that gets the home directory? This should return /home/user in Linux and x:/Documents and Settings/user (or whatever) in Windows XP. Another (unrelated) question: what is the _simplest_ way to read and write R variables to/from files such that they are stored in a

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Andris Jankevics
If you want get a username of user currently running R on Linux,you can use a system command and read enviroment variables: paste(/home/,system (whoami,intern=TRUE),sep=) Andris Jankevics On Piektdiena, 23. Marts 2007 14:30, Alberto Monteiro wrote: Is there any generic function that gets the

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Henrik Andersson
Sys.getenv(HOME) works in Linux at least - Henrik Andris Jankevics wrote: If you want get a username of user currently running R on Linux,you can use a system command and read enviroment variables: paste(/home/,system (whoami,intern=TRUE),sep=) Andris Jankevics On Piektdiena, 23. Marts

Re: [R] Get home directory and simple I/O

2007-03-23 Thread jim holtman
On 3/23/07, Alberto Monteiro [EMAIL PROTECTED] wrote: Is there any generic function that gets the home directory? This should return /home/user in Linux and x:/Documents and Settings/user (or whatever) in Windows XP. Another (unrelated) question: what is the _simplest_ way to read and write

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
See: ?R.home ?dput On 3/23/07, Alberto Monteiro [EMAIL PROTECTED] wrote: Is there any generic function that gets the home directory? This should return /home/user in Linux and x:/Documents and Settings/user (or whatever) in Windows XP. Another (unrelated) question: what is the _simplest_

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Liaw, Andy
From: Gabor Grothendieck See: ?R.home That's not what Alberto wanted: It gives the location of the R installation, not where user's home directory is. AFAIK Windows does not set the HOME environment variable by default. ?dput On 3/23/07, Alberto Monteiro [EMAIL PROTECTED] wrote: Is

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Prof Brian Ripley
But the request was for a *generic* solution. On Windows there might not be anything corresponding to a home directory (and the rw-FAQ discusses the concept and how R resolves this). The best answer I know of is path.expand(~). On Fri, 23 Mar 2007, Henrik Andersson wrote: Sys.getenv(HOME)

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
On 3/23/07, Liaw, Andy [EMAIL PROTECTED] wrote: From: Gabor Grothendieck See: ?R.home That's not what Alberto wanted: It gives the location of the R installation, not where user's home directory is. AFAIK Windows does not set the HOME environment variable by default. ok. Try this,

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Gabor Grothendieck
path.expand(~) also seems to work on Windows XP. On 3/23/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: But the request was for a *generic* solution. On Windows there might not be anything corresponding to a home directory (and the rw-FAQ discusses the concept and how R resolves this). The

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Alberto Monteiro
Prof Brian Ripley wrote: But the request was for a *generic* solution. On Windows there might not be anything corresponding to a home directory (and the rw-FAQ discusses the concept and how R resolves this). The best answer I know of is path.expand(~). Thanks, this is the only solution

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Peter Dalgaard
Andris Jankevics wrote: If you want get a username of user currently running R on Linux,you can use a system command and read enviroment variables: paste(/home/,system (whoami,intern=TRUE),sep=) This would be more to the point (and safer), I think. Sys.getenv(HOME) HOME /home/bs/pd