From savicky at cs.cas.cz  Mon Feb 14 19:36:44 2011
From: savicky at cs.cas.cz (Petr Savicky)
Date: Mon, 14 Feb 2011 19:36:44 +0100
Subject: [Rd] R command line and pipe using in Linux?
In-Reply-To: <AANLkTimNYYpwWJDiNxhxq+Ay-i8DmqQU=H5dLE9gxRVR@mail.gmail.com>
References: <AANLkTimNYYpwWJDiNxhxq+Ay-i8DmqQU=H5dLE9gxRVR@mail.gmail.com>
Message-ID: <20110214183644.GB25057@cs.cas.cz>

On Mon, Feb 14, 2011 at 05:40:29PM +0000, Hang PHAN wrote:
> Hi,
> I have a very large data file(GB) from which I only want to extract one
> column to draw histogram. This would be done several times, so I would like
> to ask if there is anyway to plot this using R from the linux command line,
> something look like this
> 
> cut -f1 xxx.txt |RplotHist ....

Hi Hang:

Can you use something like the following?

  x <- as.numeric(system("cut -f1 xxx.txt", intern=TRUE))

According to ?system, long lines will be split, however, no limit
on the number of lines of the output is formulated there.

Petr Savicky.



[Rd] R command line and pipe using in Linux?
Petr Savicky