[R] Reading complicated data file

Jim Michael jm at xmlworks.com
Wed Sep 25 18:52:20 CEST 2002


On Wednesday 25 September 2002 07:15 am, zlamal at ufi.fme.vutbr.cz wrote:
> Hi, I am new in R and I have problem with reading this data file
>
> 0 TITLE Title
>  0 XLEGEND Legend
> -1 LABEL x
> 1 1 12
> 1 2 30
> 1 3 34
>
> I want to read only lines starting with 1 (it indicates 1st plotting line)
> and create data set from second and third value on this row.
>
> Thank for advice
> Jakub Zlamal

Is it practical for you to filter the file, e.g. with a perl script?

#!/usr/bin/perl -w
$file = shift;
open IN, $file or die $!;
while (<IN>) {
	print if /^1/;
}

Cheers,

Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list