Clifford Sobchuk writes:
>
> I found a couple of problems in my rcols format and
> the regexp and have corrected that so that rcols
> responds without error. I missed that the INCLUDE is
> just the filter and had the listed the columns as per
> the groupings, and I had forgotten the PERLCOL in the
> column identifiers.

Hi Cliff-

Are you using the latest PDL?  The PERLCOLS support
in rcols() should allow you to get any columns you
select as a ref to a perl array rather than a piddle:

pdl> # cat eg.cols 
 1      1       11      one     1       oneone  1       oneoo  111      -1.1  
1111
 2      2       22      one     2       oneone  2       oneoo  222      -2.2  
2222
 3      3       33      one     3       oneone  3       oneoo  333      -3.3  
3333
 4      4       44      one     4       oneone  4       oneoo  444      -4.4  
4444
 5      5       55      one     5       oneone  5       oneoo  555      -5.5  
5555

Without PERLCOLS you get this

pdl> p join "\n", rcols 'eg.cols', { INCLUDE=>'/^\s+\d\t\d/' }
Reading data into piddles of type: [ Double Double Double Double Double Double 
Double Double Double Double Double ]
Read in 5 elements.
[1 2 3 4 5]
[1 2 3 4 5]
[11 22 33 44 55]
[0 0 0 0 0]
[1 2 3 4 5]
[0 0 0 0 0]
[1 2 3 4 5]
[0 0 0 0 0]
[111 222 333 444 555]
[-1.1 -2.2 -3.3 -4.4 -5.5]
[1111 2222 3333 4444 5555] 

But with PERLCOLS you get this

pdl> p join "\n", rcols 'eg.cols', { INCLUDE=>'/^\s+\d\t\d/', PERLCOLS=>[3,5,7] 
}
Reading data into piddles of type: [ Double Double Double Double Double Double 
Double Double ]
Read in 5 elements.
[1 2 3 4 5]
[1 2 3 4 5]
[11 22 33 44 55]
ARRAY(0x3821050)
[1 2 3 4 5]
ARRAY(0x3821938)
[1 2 3 4 5]
ARRAY(0x3821488)
[111 222 333 444 555]
[-1.1 -2.2 -3.3 -4.4 -5.5]
[1111 2222 3333 4444 5555] 

Cheers,
Chris



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to