Statis...::R::IO(3pm)
π Statistics::R::IO π
okay bestie, welcome to Statistics::R::IO β a Perl interface to serialized R data, living its best life under the User Contributed Perl Documentation umbrella. it's giving "I speak fluent R but I'm a Perl girlie". no cap.
VERSION: version 1.0002 π
β¨ SYNOPSIS β¨
look at her go, she's literally so capable:
use Statistics::R::IO;
my $var = Statistics::R::IO::readRDS('file.rds');
print $var->to_pl;
my %r_workspace = Statistics::R::IO::readRData('.RData');
while (my ($var_name, $value) = each %r_workspace) {
print $var_name, $value;
}
my $pi = Statistics::R::IO::evalRserve('pi');
print $pi->to_pl;
πΈ DESCRIPTION πΈ
so this module is a pure-Perl implementation for reading native data files produced by the R statistical computing environment (<http://www.r-project.org>). she's not borrowing anything from C, she's doing it all herself. iconic.
she provides routines for reading files in the two primary file formats used in R for serializing native objects:
- RDS β RDS files store a serialization of a single R object (and, if the object contains references to other objects, such as environments, all the referenced objects as well). These files are created in R using the
readRDSfunction and are typically named with the.rdsfile extension. one object, one file, very main character. - RData β RData files store a serialization of a collection of named objects, typically a workspace. These files are created in R using the
savefunction and are typically named with the.RDatafile extension. (Contents of the R workspace can also be saved automatically on exit to the file named.RData, which is by default automatically read in on startup.) it's giving group chat, not DM.
As of version 0.04, the module can also evaluate R code on a remote host that runs the Rserve (<http://www.rforge.net/Rserve/>) binary R server. This allows Perl programs to access all facilities of R without the need to have a local install of R or link to an R library. π
remote queen behavior.
See "SUBROUTINES" for invocation and usage information on individual subroutines, and the R Internals manual (<http://cran.r-project.org/doc/manuals/R-ints.html>) for the specification of the file formats.
π¦ EXPORT π¦
Nothing by default, bestie. Optionally, subroutines readRDS, readRData, and evalRserve, or :all for all three. pick your faves. π«Ά
π SUBROUTINES π
readRDS EXPR
Reads a file in RDS format whose filename is given by EXPR and returns a Statistics::R::REXP object. hand her a filename, she hands you an object. the exchange rate is immaculate.
readRData EXPR
Reads a file in RData format whose filename is given by EXPR and returns a hash whose keys are the names of objects stored in the file with corresponding values as Statistics::R::REXP instances.
evalRserve REXPR [ HOSTNAME [, PORT] | HANDLE ]
Evaluates an R expression, given as text string in REXPR, on an Rserve (<http://www.rforge.net/Rserve/>) server and returns its result as a Statistics::R::REXP object.
The server location can be specified either by its host name and (optionally) port or by a connected instance of IO::Handle. The caller passing the HANDLE is responsible for reading (and checking) the server ID that is returned in the first 32-byte response when the connection was established. This allows opening the connection once and reusing it in multiple calls to 'evalRserve'. reuse era fr fr.
If only REXPR is given, the function assumes that the server runs on the localhost. If PORT is not specified, it defaults to the standard Rserve port, 6311.
heads up bestie: The function will close the connection to the Rserve host if it has opened it itself, but not if the connection was passed as a HANDLE. she's not gonna close a door she didn't open. that's your door now.
π DEPENDENCIES π
Requires perl 5.010 or newer.
Core modules
strictwarningsoverloadCarpExporterModule::BuildScalar::UtilTest::More
Additional CPAN modules
Class::TinyClass::Tiny::AntlersClass::Method::Modifiersnamespace::cleanTest::Fatal
π BUGS AND LIMITATIONS π
okay this is the part where we're honest with each other. π«Ά
The module currently handles the 'version 2' serialization format, used since R 1.4.0 (released in December 2001). Only XDR and native-order binary is implemented, and since the R documentation describes the ASCII save format as "now mainly of historical interest", this is unlikely to change soon. no check is performed that a file stored in native-order binary was created on a platform that used the same order, and it is up to the caller to ensure compatibility. (Given that the default save format is XDR, and the prevalence of Intel platforms, this is unlikely to be a problem for either publicly-distributed or internal data files.) so like. probably fine. but you were warned.
Data files compressed with gzip and bzip2 are supported, but not xz ones. Again, given the R defaults (gzip) and the fact that IO::Uncompress::UnXz is not production-ready, this is unlikely to change soon. rip xz. π
There are some R types that are not (yet) implemented, although all typical "user-facing" types β such as vectors, lists, and environments β are. The remaining R types will be implemented as-needed; in other words, if you come across one that you need to read a particular file, please send me the type (the id will included in the unimplemented SEXPTYPE error message) and, if possible, how it was generated. the way that she's taking requests like a DJ. π§
There are no known bugs in this module. Please report any bugs or feature requests to bug-statistics-r-io at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Statistics-R-IO>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. accountability slay.
π SUPPORT π
You can find documentation for this module with the perldoc command.
perldoc Statistics::R::IO
You can also look for information at:
- RT: CPAN's request tracker (report bugs here)
- AnnoCPAN: Annotated CPAN documentation
- CPAN Ratings
- Search CPAN
π§ AUTHOR π§
Davor Cubranic <cubranic@stat.ubc.ca>
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2017 by University of British Columbia.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
and that's the whole page, bestie π
this was perl v5.34.0, dated 2022-02-10, and you just read Statis...::R::IO(3pm) β she's been out here since 2017 and she still ate. mwah. πβ¨
π¦ where this page comes from
- debian bookworm: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- debian trixie: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu jammy: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu noble: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu resolute: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- ubuntu stonking: libstatistics-r-io-perl 1.0002-2 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms