Thank you Ted.
I did try page(file,method="print"), it did behave as "less".

I will try the code to modify the profile as well to see how it goes. Thank
you very much.

On Mon, Aug 24, 2009 at 5:32 PM, Ted Harding
<ted.hard...@manchester.ac.uk>wrote:

> On 24-Aug-09 21:56:06, zrl wrote:
> > Dear List:
> > I am trying to find a command in R which is like the unix command
> > "less" or "more" to show the data in a object of R.
> > did anyone can help me on this?
> >
> > Is there a collection of such unix-like commands in R?
> >
> > Thanks.
> >
> > -ZRL
>
> There is a page() command in R -- see '?page'. From your query I take
> it you are in fact using either Linux or Unix (or possible a Mac BSD
> type OS).
>
> Have a look at  options("pager")  to see what is currently uses.
>
> I have modified my R setup so that it uses 'less' (on Linux) as
> the pager program.
>
> I did this in my .Rprofile (in home directory) by putting in the
> lines:
>
>
> .xthelp <- function() {
>    tdir <- tempdir()
>    pgr <- paste(tdir, "/pgr", sep="")
>    con <- file(pgr, "w")
>    cat("#! /bin/bash\n", file=con)
>    cat("export HLPFIL=`mktemp ", tdir, "/R_hlp.XXXXXX`\n",
>        sep="", file=con)
>    cat("cat > $HLPFIL\nxterm -e less $HLPFIL &\n", file=con)
>    close(con)
>    system(paste("chmod 755 ", pgr, sep=""))
>    options(pager=pgr)
> }
> .xthelp()
> rm(.xthelp)
>
>
> This opens anything which might be paged in a separate xterm,
> so thatfor instance, all responses to "?....." come up in a new
> xterm being paged by 'less'. Likewise, if you page a large object
> (such as a matrix M with 500 rows), using 'page(M), you will
> again see the result paged in 'less' in a separate window.
>
> This code was suggested by Roger Bivand in response to a query
> of mine back in 2003. The URL is
>
>  http://finzi.psych.upenn.edu/R/Rhelp02/archive/21642.html
>
> This was an improvement on a previous solution of my own, which
> is also quoted in the above URL.
>
> Hoping this helps,
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 24-Aug-09                                       Time: 23:32:18
> ------------------------------ XFMail ------------------------------
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to