[R] grey colored lines and overwriting labels i qqplot2
djmuser at gmail.com
Sun Jul 10 13:33:30 CEST 2011
Here's a simple example:
> df <- data.frame(x = 1:10, y = rnorm(10))
structure(list(x = 1:10, y = c(-1.55669581922794, -0.6086844726417,
-0.414989571570644, -0.202690819994734, -0.421436945159872,
-0.193955384660702, -0.764966890023485, -0.740871219664316, -0.0193951410439701
)), .Names = c("x", "y"), row.names = c(NA, -10L), class = "data.frame")
### Other end:
df <- <copy and paste the lines below dput>
It should match this:
'data.frame': 10 obs. of 2 variables:
$ x: int 1 2 3 4 5 6 7 8 9 10
$ y: num -1.557 -0.609 -0.415 -0.203 -0.421 ...
The advantages of dput() form are that:
(i) the structure of the (data) object in question is preserved;
(ii) it can be copied and pasted directly into one's R session from an e-mail;
(iii) it is text-based and therefore portable across platforms (e.g.,
Mac, Linux, PC).
Sending data in dput() form assures a potential helpeR that the
structure of the data will be exactly the same in his/her R session as
it is in yours. This is not always the case if you copy and paste a
portion of data from the console to an e-mail; for example, integer
variables on the sender's end may end up read as numeric on the other
end, character variables may be read in as factors (most notoriously,
dates), etc. These infelicities can matter and cause confusion and/or
frustration on both ends. dput() is the safest way to portably
transfer data in R.
The other option, which is equally safe, is to send the code to
generate a toy data set that is replicable on the other end,
preferably with a prefatory set.seed() statement, something like
df <- data.frame(x = 1:10, y = rnorm(10))
1 1 0.50587229
2 2 2.34666229
3 3 -0.05024859
4 4 1.40323363
With a stated set.seed(), the y values should be the same on both ends.
I can't speak for anyone else, but I decided a while ago that if a
poster didn't show enough courtesy to provide a reproducible example,
I wasn't going to invest time or energy responding to the question
unless the answer was obvious or I had a personal interest in the
question at hand. There's a reason why the Posting Guide exists. When
you follow its guidelines, there is ample evidence to show that:
(a) more people are willing to look at the problem and provide useful feedback;
(b) the answers will usually arrive quickly;
(c) you will often end up with multiple solutions to the problem, or a
diagnosis of why something didn't work.
This is a very high volume list - it's not unusual for 100+ messages
to pass back and forth in a single day. With that amount of
competition for the time and attention of potential helpeRs, those who
learn how to post readily answerable questions generally get more
attention than those who do not.
Thank you for showing enough consideration to want to learn how to
post in a manner that benefits both you and potential helpeRs. I
sincerely hope this is helpful to you (and perhaps others in a similar
On Sat, Jul 9, 2011 at 10:36 PM, Sigrid <s.stenerud at gmail.com> wrote:
> Thank you, Ista, for your quick response and tip. I would love to make a
> reproducible example and was not aware of the dput codes as I am a new user.
> Is there anywhere I can read up on how to use dput?
> View this message in context: http://r.789695.n4.nabble.com/grey-colored-lines-and-overwriting-labels-i-qqplot2-tp3657119p3657200.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help