Calling an expression that was created using a sample
When I want to view structures as they are called, I can usually do so with enquote
.
For an arbitrary list, d
this would be
> d <- list(a = 1, b = 2)
> enquote(d)
# quote(list(a = 1, b = 2))
But for an object created with a sample it is different. sample
does not appear in the quoted call.
> m <- matrix(sample(2))
> enquote(m)
# quote(c(2L, 1L))
Is there a way to show the expression / expression created m
to appear sample
? So the result will be something like
quote(matrix(sample(2))
Update: . Simon's answer is below, but I'd really like to know if I can get an answer that doesn't require use substitute
to create a matrix m
.
source to share