I think you are looking for dput
:
> dput(data)
structure(list(x = 1:10, y1 = c(3, 5, 1, 8, 2, 4, 5, 0, 8, 2),
y2 = c(1, 8, 2, 1, 4, 5, 3, 0, 8, 2)), .Names = c("x", "y1",
"y2"), row.names = c(NA, -10L), class = "data.frame")
> data0<-structure(list(x = 1:10, y1 = c(3, 5, 1, 8, 2, 4, 5, 0, 8, 2),
+ y2 = c(1, 8, 2, 1, 4, 5, 3, 0, 8, 2)), .Names = c("x", "y1",
+ "y2"), row.names = c(NA, -10L), class = "data.frame")
> identical(data,data0)
[1] TRUE