PDL::Role::HasNames - Role for attaching per-element names to a piddle
version 0.002003
At current stage this module is experimental. It was created for being internally used by Chart::GGPlot. Please contact the author if you would like to directly use this module in your code.
use PDL; use Role::Tiny (); my $p = pdl(1..3); Role::Tiny->apply_roles_to_object($p, 'PDL::Role::HasNames'); $p->names([qw(foo bar baz)]);
This role tries to provide a way to make something similar as R's feature of the names attribute, which allows attaching a per-element string name to a vector.
names
For some PDL methods like copy and slice, the names attribute is retained in the result. For many other methods, it's lost.
copy
slice
Per-element names attached to the piddle.
It's an "rw" attribute. In the "writer" mode, either an arrayref or a PDL::SV object are acceptable. PDL::SV is use internally, so in case of an arrayref it would be converted to a PDL::SV object. The specified value has to be of same dimensions as the original piddle. In the "reader" mode, it returns a PDL::SV object.
Role::Tiny, PDL::SV
Stephan Loyd <sloyd@cpan.org>
This software is copyright (c) 2019-2023 by 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 Chart::GGPlot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Chart::GGPlot
CPAN shell
perl -MCPAN -e shell install Chart::GGPlot
For more information on module installation, please visit the detailed CPAN module installation guide.