NAME
PDL::Role::HasNames - Role for attaching per-element names to a piddle
VERSION
version 0.0010_01
STATUS
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.
SYNOPSIS
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)]);
DESCRIPTION
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.
For some PDL methods like copy
and slice
, the names
attribute is retained in the result. For many other methods, it's lost.
ATTRIBUTES
names
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.
SEE ALSO
AUTHOR
Stephan Loyd <sloyd@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 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.