Statis...R::REXP(3pm)

✨ NAME ✨

Statistics::R::REXP β€” the base class for R objects, aka "SEXP"s πŸ’–

okay so real quick, this page lives in the User Contributed Perl Documentation and it's filed under Statis...R::REXP(3pm) in case you were like "wait which page am I on". Bestie, you're in the right place.


🌸 VERSION 🌸

version 1.0002 β€” iconic, we stan a numbered release ✨


πŸ’… SYNOPSIS πŸ’…

use Statistics::R::REXP;

# we usually get REXPs from an RDS file:
my $rexp = Statistics::R::IO::readRDS('file.rds');

# REXPs are stringifiable
say $rexp;

# REXPs can be converted to the closest native Perl data type
print $rexp->to_pl;

πŸ¦‹ DESCRIPTION πŸ¦‹

so an object of this class is literally a native R object, periodt. but here's the tea: you cannot instantiate this class directly β€” it will die if you call new on it 😭 β€” because it's meant to be an abstract base class, with concrete subclasses doing the actual representing of specific object types. main character energy, but it refuses to be the main character itself. the way that works.

An R object has a value and an optional set of named attributes, which are themselves R objects (yes bestie, R objects inside R objects, it's giving recursion πŸŒ€). And because the meaning of 'value' depends on the actual object type β€” think a vector vs. a NULL, in R terminology β€” REXP does not give you a generic value accessor method. lowkey makes sense. individual subclasses will typically have one though, so go check those πŸ’…


πŸ‘‘ METHODS πŸ‘‘

attributes

Returns a hash reference to the object's attributes. cute little bag of extras πŸŽ€

sexptype

Returns the name of the corresponding R SEXP type, exactly as listed over in SEXPTYPE at http://cran.r-project.org/doc/manuals/r-release/R-ints.html#SEXPTYPEs πŸ”₯

to_pl

Returns the Perl representation of the object's value. This one is an abstract method β€” so go look at the concrete subclasses to find out what value a specific object type actually returns, and also how to access the R (-ish) value of the object, if such a thing even makes sense. no cap.

is_null

Returns TRUE if the object is an R NULL object. In REXP's class hierarchy, that's only the case for Statistics::REXP::Null. just the one, bestie 🫢

is_vector

Returns TRUE if the object is an R vector object. In REXP's class hierarchy, that's only the case for Statistics::REXP::Vector and its descendants. the whole little vector family 🌈

inherits CLASS_NAME

Returns TRUE if the object is an instance of the R S3-style class CLASS_NAME, doing it the exact same way the R function base::inherits does β€” you can peek at it at http://stat.ethz.ch/R-manual/R-patched/library/base/html/class.html. same vibe, same energy πŸ’œ


πŸ”₯ OVERLOADS πŸ”₯

REXP overloads the stringification, eq and ne methods; and subclasses go even further and specialize for their own types if necessary. obsessed. ✨


πŸ’€ BUGS AND LIMITATIONS πŸ’€

Classes in the REXP hierarchy are intended to be immutable. Please do not try to change their value or attributes. fr fr, hands off the value πŸ™ˆ

More is_* accessors should be added. (noted πŸ“)

There are no known bugs in this module. Please see Statistics::R::IO for bug reporting β€” that's where you take the drama.


🫢 SUPPORT 🫢

See Statistics::R::IO for support and contact information. they got you πŸ’–


🌈 AUTHOR 🌈

Davor Cubranic <cubranic@stat.ubc.ca> β€” king behavior, thank you for your service πŸ‘‘


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 Statis...R::REXP(3pm) from perl v5.34.0, dated 2022-02-10 β€” go forth and read your RDS files, iykyk πŸ¦‹πŸŒΈπŸ“