Suppose an object is already defined in the workspace:
a <- round( rnorm(10) )
[1] 0 -1 -1 -1 -1 0 2 1 1 1
How can I programatically generate a command which creates a
?
For example, I would like to use the a
in my workspace to generate the following string codeToCreateA
:
codeToCreateA <- "a <- c( 0, -1, -1, -1, -1, 0, 2, 1, 1, 1)"
I'm interested in the general case, in which a
could be any class of object, including a vector, list, or data frame.