Say I am reading a post where someone has included example data dput()
. Is there a method to recreate that data by copying and pasting the dput output?
For example:
dput(analysis)
structure(c("1", "2", "3", "95", "76", "73", "3.9 [3, 4.7]",
"3.9 [2.9, 4.9]", "3.9 [2.9, 4.9]", "-0.149364093194283", "-0.0634756995556436",
"-0.0800909978288318", "8 [7, 9]", "8.2 [7.2, 9.3]", "8.3 [7.2, 9.3]",
"0.000201414878031159", "0.214881972259157", "0.268328556507466"
), .Dim = c(3L, 6L), .Dimnames = list(NULL, c("Module", "Individuals",
"y1 [95CI]", "y1 - mu", "y2 [95CI]", "y2 - mu")))
Is there a simpler way to reproduce this instead of manually creating multiple vectors, naming them etc?
I'm interested in the method behind this, as I feel it would save time when recreating people's shared data e.g. when answering other people's stackoverflow questions.
Turns out the answer is quite mundane. Simply assigning the dput
output a variable does the trick.
For example:
m <- dput(structure(c("1", "2", "3", "9532", "6968", "6637", "4 [3.9, 4.1]",
"4 [3.9, 4.1]", "4 [3.9, 4.1]", "0.0187143916545995", "0.00863901324167671",
"0.00960376951904252", "8 [7.9, 8.1]", "8 [7.9, 8.1]", "8 [7.9, 8.1]",
"0.0187528128796863", "0.00481608674854073", "0.0173215731030023"
), .Dim = c(3L, 6L), .Dimnames = list(NULL, c("Module", "Individuals",
"y0 [95CI]", "y0 - mu", "y1 [95CI]", "y1 - mu")))
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With