NAME
Chart::GGPlot::Util - Utility functions
VERSION
version 0.0007
FUNCTIONS
remove_missing
remove_missing($df,
:$na_rm=false, :$vars=$df->names,
:$name='', :$finite=false)
Remove all non-complete rows, with a warning if $na_rm
is false. For those stats which require complete data, missing values will be automatically removed with a warning. If $na_rm
is true, the warning will be suppressed.
$df
Data frame object.
$na_rm
If true, will suppres warning message.
$vars
An arrayref of variables to check for missings in.
$name
Optional function name to improve error message.
$finite
If true, will also remove non-finite values.
call_if_coderef($x, @args)
If $x
is a coderef, call it with @args
, otherwise returns $x
.
alias_color_functions($package, @function_names)
Given an array of functions, for those with "color" in names, create alias function with "colour" in name, and return an array of all aliased and non-aliased.
This can be used in a packge like
our @EXPORT_OK = alias_color_functions(__PACKAGE__, @function_names);
resolution
resolution(Piddle1D $x, $zero=true)
The resolution is the smallest non-zero distance between adjacent values.
If $x
has a single value, or an interger vector which can be assumed to represent a discrete value, then the resolution is 1. If $x
is a float vector, the resolution is the minimal distance between ajacent values in sorted $x
.
If $zero
is true, 0 would be inserted into the vector, if it's does not already in the vector, when computing the resolution.
stat
Can be used in aes()
quosure values as a flag to Chart::GGPlot to indicate that you want to use calculated aesthetics produced by the statistic.
Note that this function has same name as Perl's CORE stat
function.
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.