Skip to content

Instantly share code, notes, and snippets.

@rpietro
Forked from anonymous/dput_example.R
Created December 18, 2012 19:12
Show Gist options
  • Save rpietro/4330967 to your computer and use it in GitHub Desktop.
Save rpietro/4330967 to your computer and use it in GitHub Desktop.
#assume you have a data set represented by an object called BOD (BOD is actually a dataset internal to R). then run dput with that data object
dput(BOD)
#the ouput of this function will be the representation of that data set: structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3, 19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA, -6L), class = "data.frame", reference = "A1.4, p. 270")
#when you want to request help, just start the reproducible example by throwing the output of dput into a data object:
BOD <- structure(list(Time = c(1, 2, 3, 4, 5, 7), demand = c(8.3, 10.3, 19, 16, 15.6, 19.8)), .Names = c("Time", "demand"), row.names = c(NA, -6L), class = "data.frame", reference = "A1.4, p. 270")
#from here on then just write the code you wrote and the corresponding error message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment