Maybe I'm imagining this, but I think there is a built-in R function that lets you print an R vector (and possibly other objects like matrices and data frames) in the format that you would use to enter that object (returned as a string). E.g.,
> x <- c(1,2,3)
> x
[1] 1 2 3
> magical.function(x)
"c(1,2,3)"
Does this function exist?