Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2012 21:01
Show Gist options
  • Save anonymous/4246998 to your computer and use it in GitHub Desktop.
Save anonymous/4246998 to your computer and use it in GitHub Desktop.
An example on how to use dput - got this from Hadley http://goo.gl/5BGlW
#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