Title: | Easy access to attributes |
---|---|
Description: | Easy access to attributes using esnail (at) |
Authors: | Mark Bravington <[email protected]> |
Maintainer: | Mark Bravington <[email protected]> |
License: | GPL (>=2) |
Version: | 1.0.33 |
Built: | 2025-01-07 04:13:28 UTC |
Source: | https://github.com/markbravington/atease |
Package atease lets you write x@att
as shorthand for attr( x, "att")
, even for non-S4 objects. @<-
is the analogue for replacements, called automatically during e.g. x@att <- 1
. For an S4 object, @
and @<-
access the slots, as usual; there might be some minuscule speed penalty, but (i) you shouldn't really be accessing slots of other people's S4 objects directly, and (ii) if you're writing your own S4 object, you won't be using the atease package! Although perfectly legal, this is no doubt considered all very naughty and would be reviled by S4 fans...
object@name object@name<- value
object@name object@name<- value
object |
any object |
name |
the unquoted name of an attribute (or slot) |
value |
what to put in the attribute (or slot) |
l <- list(0) attr( l[[1]], 'thing') <- 66 l[[1]]@thing # 66 l[[1]]@thing <- 44 attr( l[[1]], 'thing') # 44
l <- list(0) attr( l[[1]], 'thing') <- 66 l[[1]]@thing # 66 l[[1]]@thing <- 44 attr( l[[1]], 'thing') # 44