Statis...onment(3pm)
π Statistics::R::REXP::Environment π
okay bestie, so this is a page from the User Contributed Perl Documentation (that's the 3pm section, the Perl module zone), and it's all about Statistics::R::REXP::Environment β literally the Perl class that models an R environment. Let's get into it π«Ά
β¨ NAME β¨
Statistics::R::REXP::Environment β it's an R environment, that's the whole vibe π¦
πΈ VERSION πΈ
version 1.0002 β yes, she's on that version, keep up π
π SYNOPSIS π
here's the tea, this is how you'd actually touch it:
use Statistics::R::REXP::Environment
my $env = Statistics::R::REXP::Environment->new({
x => Statistics::R::REXP::Character->new(['foo', 'bar']),
b => Statistics::R::REXP::Double->new([1, 2, 3]),
});
print $env->elements;
likeβ¦ make the env, print the elements. slay β¨
π DESCRIPTION π
so an object of this class represents an R environment, which in R-land is called ENVSXP. no cap.
Environments in R are made of two things: a frame, which is a set of symbol-value pairs, and an enclosure, which is a pointer to an enclosing environment (you can also call it the "parent" environment, bestie, they're the same thing π). Environments form a tree structure, and at the very root of that tree sits a special emptyenv environment that has no parent. she's the origin story, the main character at the top of the family tree π³π
(okay so the original page has a paragraph here that lowkey reads like it belongs to a different class β it talks about calls like model formulae β but im telling you exactly what it says, no edits: these objects represent calls (such as model formulae), with first element a reference to the function being called, and the remainder the actual arguments of the call. Names of arguments, if given, are recorded in the 'names' attribute (itself as Statistics::R::REXP::Character vector), with unnamed arguments having name ''. If no arguments were named, the environment objects will not have a defined 'names' attribute. that's word-for-word what's on the page, so there it is π)
β οΈ real talk: you should NOT be creating instances of this class yourself. it exists mainly to handle deserialization ofENVSXPs by theIOclasses. it's giving internal machinery, not a toy π
π METHODS π
Statistics::R::REXP:Environment inherits from Statistics::R::REXP::Vector, with one extra restriction: its first element has to be a Statistics::R::REXP::Symbol or another Environment instance. if you try to create a Environment instance that breaks that rule, it will raise an exception. like, it will not let you, periodt π«
π ACCESSORS π
frameβ hands you a reference to the hash of symbol-value pairs that make up the environment's frame, aka the variables with bound values in that environment ποΈenclosureβ hands you a reference to the parentEnvironment, if it's defined. if there's no parent, wellβ¦ nothing to hand you π€·βοΈnameβ environments can have a name, though this isn't normally settable from R code. typically it's only the system environments (like namespaces) and environments created byattach-ing an object that actually have a name. so if you've got a named one, she's special β¨sexptypeβ the SEXPTYPE of environments isENVSXP. that's just the facts πβοΈto_plβ environments do NOT have a native Perl representation, so trying to call this accessor will raise an exception. don't do it bestie, it's a trap π
π BUGS AND LIMITATIONS π
Classes in the REXP hierarchy are meant to be immutable. please do not try to change their value or attributes. they said what they said, leave her alone π
βοΈ
There are no known bugs in this module. for bug reporting, go see Statistics::R::IO π
π«Ά SUPPORT π«Ά
See Statistics::R::IO for support and contact information. that's where the help lives π
β AUTHOR β
Davor Cubranic <cubranic@stat.ubc.ca> β thank you for your service, icon π
π 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
GPL v3, June 2007, free as in freedom, we love to see it π
and that's the whole page bestie!! this one's from perl v5.34.0, dated 2022-02-10, and yes the man page title gets truncated all cute like that (Statis...onment(3pm)) because it doesn't fit β anyway, mwah, go read Statistics::R::IO next, ily, bye ππβ¨
π¦ 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