in reply to Re^2: Descriptive Stats from .csv file
in thread Descriptive Stats from .csv file
You can use the Data::Table::Excel module to put the contents of a Data::Table object into an Excel file. From the documentation,
This perl package provide utility methods to convert between an Excel file and Data::Table objects. It then enables you to take advantage of the Data::Table methods to further manipulate the data and/or export it into other formats such as CSV/TSV/HTML, etc.
For example, this code will create an xlsx file that contains both the mean and stddev tables:
#!/usr/bin/env perl use strict; use warnings; use Data::Table; use Data::Table::Excel qw(tables2xlsx); use Statistics::Lite qw(mean stddev); my $dt = Data::Table::fromCSV("data.csv"); my $melt = $dt->melt(['Month', 'Zone', 'Replicate']); my $cast_mean = $melt->cast( ['Month', 'Zone'], 'variable', Data::Table::STRING, 'value', \&mean ); my $cast_stddev = $melt->cast( ['Month', 'Zone'], 'variable', Data::Table::STRING, 'value', \&stddev ); tables2xlsx("descriptive_stats.xlsx", [ $cast_mean, $cast_stddev ]); exit;
|
|---|