Will work, but as you mentioned there ought to be an easier way :-) > -----Original Message----- > From: Mike R [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 09, 2005 10:29 PM > To: Vadim Ogranovich > Subject: Re: [R] Redirect console to file > > On 6/9/05, Mike R <[EMAIL PROTECTED]> wrote: > > On 6/9/05, Vadim Ogranovich <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > Is it possible to redirect the staff that normally goes to the R > > > console window into a file. sink() does this for sdterr > and stdout. > > > But I need something that redirects "everything" that > appear in the > > > console window (including the top-level commands). > > > > > > I want to achieve the same effect as that of the > following command > > > under > > > sh: > > > R < foo.R &> foo.Rt > > > > > > only I want the redirection to be activated within the > foo.R script. > > > (The reason being that the name of the file is computed inside > > > foo.R) > > > > > > since foo.Rt will be an ascii file, write the name of the file to a > > generic name, say foo.Rt > > > > then run your R session with a shell script. after runnin R, > > have the shell script use grep or sed to grab the specific filename > > from the contents of the generic file (foo.Rt). then have the shell > > script rename the generic file. > > > > ...... that being said, there has got be an easier way !!!! > > let me restate that in english (LOL) > > Since the output file (foo.Rt) will be an ascii file, have > your R-code write the computed name of the file to the > generically named output file (foo.Rt) along with everything else. > > Then run your R session with a shell script. After running R, > have the shell script use grep or sed to grab the computed > filename from the contents of the generic file (foo.Rt). Then > have the shell script rename the generic file to the computed name. >
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html