First, follow the agreed-upon standards to ask a great R question and make a great R reproducible example (see this discussion):
- Share your data. Data small and simple enough to reproduce the problem.
- Don't overload reserved names, such as
c
, df
or data
.
- As far as possible, use R's or package's standard datasets, such as
mtcars
or iris
. Don't share links to files, most of us don't like downloading files from unknown parties.
- Share your code.
For graph/plot/map-generating code, please:
- Include calls to
library
or require
used to load packages with which you produced the plots/graphs/maps.
Strip out all the cosmetic parts of the code, unless the problem you want to address has to do specifically with such cosmetics. Excessive and unnecessary code clutters the question, making it more difficult to understand and address.
theme
calls to format backgrounds, colors, axes and the like.
labs
calls and any similarly used to set titles, subtitles and the like.
- Coloring of lines, axis, fills and similar components.
Check if your data is tidy. If you have to make repetitive calls to produce each line in your plot, it's likely your data isn't tidy.
- Be specific about whether you are only looking for a base R,
ggplot2
or lattice
-based solution, or whether a solution from any package is acceptable.
Regarding your expected output, state it in words whenever possible. If an image is needed, please include one with at least these characteristics:
- Size: It should be big enough to allow potential helpers to appreciate the details of your expected output, but small enough to load quickly, even under an unstable internet connection.
- Type: use a format that will render in most browsers: jpg and png are good options. Avoid formats that don't or that will require proprietary software to display.
- It doesn't need to be code-generated. A paint version and even a hand-painted one can be enough, if they are of sufficient quality and focus on the expected details of the plot.
- Avoid sharing links to download images, specially if in a format that doesn't display in a standard browser: Most of us don't like downloading files from unknown parties.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…