Data::Frame::Role::Rlike
version 0.0059_01
Data::Frame::Role::Rlike - role to provide R-like methods for Data::Frame
head( Int $n=6 )
If $n ≥ 0, returns a new Data::Frame with the first $n rows of the Data::Frame.
Data::Frame
If $n < 0, returns a new Data::Frame with all but the last -$n rows of the Data::Frame.
See also: R's head function.
tail( Int $n=6 )
If $n ≥ 0, returns a new Data::Frame with the last $n rows of the Data::Frame.
If $n < 0, returns a new Data::Frame with all but the first -$n rows of the Data::Frame.
See also: R's tail function.
subset( CodeRef $select )
subset is a helper method used to take the result of a the $select coderef and use the return value as an argument to "Data::Frame#select_rows" in select_rows>.
subset
$select
select_rows
The argument $select is a CodeRef that is passed the Data::Frame $select->( $df ); # $df->subset( $select ); and returns a PDL. Within the scope of the $select CodeRef, $_ is set to a Data::Frame::Column::Helper for the Data::Frame $df.
$_
Data::Frame::Column::Helper
$df
use Data::Frame::Rlike; use PDL; my $N = 5; my $df = dataframe( x => sequence($N), y => 3 * sequence($N) ); say $df->subset( sub { ( $_->('x') > 1 ) & ( $_->('y') < 10 ) }); # --------- # x y # --------- # 2 2 6 # 3 3 9 # ---------
See also: R's subset function
Zakariyya Mughal <zmughal@cpan.org>
Stephan Loyd <sloyd@cpan.org>
This software is copyright (c) 2014, 2019-2021 by Zakariyya Mughal, Stephan Loyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Alt::Data::Frame::ButMore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alt::Data::Frame::ButMore
CPAN shell
perl -MCPAN -e shell install Alt::Data::Frame::ButMore
For more information on module installation, please visit the detailed CPAN module installation guide.