[SOLVED] Extract input of a function in R

Issue

I wonder if there might be a way to extract the input value (1:3) used in a after running object a?

library(clubSandwich)

a <- constrain_equal(1:3)

Desired output: vector 1:3

Solution

Looks like

environment(a)$constraints

works for your example (ls(environment(a)) shows you which objects are available).

Answered By – Ben Bolker

Answer Checked By – Candace Johnson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *