NAME
PSPP::Wrapper - Wrapper for the pspp command-line interface
DESCRIPTION
PSPP is a program for statistical analysis of sampled data. It is a Free replacement for the proprietary program SPSS, and appears very similar to it with a few exceptions. PSPP is particularly aimed at statisticians, social scientists and students requiring fast convenient analysis of sampled data.
For more information, see http://www.gnu.org/software/pspp/
You need to install the PSPP binary to use this module.
This module currently only contains one useful method, save, which makes it easy to generate PSPP/SPSS-compatible .sav files.
VERSION
Version 0.01
SYNOPSIS
# Generate a SPSS-compatible .sav file from an array of data
my $pspp = PSPP::Wrapper->new( verbose => 0 );
my $rows = [
[ "AMC Concord", 22, 2930, 4099 ],
[ "AMC Pacer", 17, 3350, 4749 ],
[ "AMC Spirit", 22, 2640, 3799 ],
[ "Buick Century", 20, 3250, 4816 ],
[ "Buick Electra", 15, 4080, 7827 ],
];
$pspp->save(
variables => 'make (A15) mpg weight price',
rows => $rows,
outfile => $outfile1,
) or warn "An error occurred";
# Generate a csv file ourselves from $rows
my $csv = Text::CSV_XS->new( { binary => 1 } );
my $fh = File::Temp->new( SUFFIX => '.csv' );
for my $row (@$rows) {
$csv->print( $fh, $row );
print $fh "\n";
}
$fh->close;
$pspp->save(
variables => 'make (A15) mpg weight price',
infile => $fh->filename,
outfile => $outfile2,
) or warn "An error occurred";
methods
new
Constructor. Acceptions the following options:
- verbose
- timeout
-
The IPC::Run::run timeout value
- pspp_binary
-
The location of the
pspp
binary. Defaults topspp
.
save
Generate a PSPP (and hence SPSS) compatible .sav file
You must specify either rows
or infile
. Accepts the following options:
- outfile
-
The name of the file to generate (defaults to out.sav)
- variables
-
The PSPP/SPSS variables definition
- rows
-
An array reference of rows to include in the data (optional)
- infile
-
A data-file to read from (optional)
verbose
Returns true if the verbose flag is set
AUTHOR
Patrick Donelan, <pdonelan at cpan.org>
BUGS
Please report any bugs or feature requests to bug-pspp at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PSPP::Wrapper. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc PSPP::Wrapper
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
For a module that actually groks PSPP (rather than just wrapping it) and hence allows you to read/write PSPP and/or SPSS native files, see: PSPP
ACKNOWLEDGEMENTS
http://www.gnu.org/software/pspp/
COPYRIGHT & LICENSE
Copyright 2009 Patrick Donelan, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.