I have variable mod of class unmarkedFitPCount from package unmarked and I need to add a new attribute to that class:
mod@new_attr <- 1
I get an error:
‘new_attr’ is not a slot in class “unmarkedFitPCount”
I need to add this new attribute without creating a new derived class, because I need all those functions to work on this object. This is supposed to be just a very lightweight temporary hack. How can I do that?
What about:
attributes(mod)$new_attr <- 1.The core function
attributesaccesses an object's attributes. In this example you create a new attributenew_attrand assign it the value of 1.You can then access the newly created attribute via
attributes(mod)$new_attr.