[R] Creating a scatterplot with sequential dates on x-axis?
Joshua Wiley
jwiley.psych at gmail.com
Mon Aug 8 02:06:44 CEST 2011
Hi Caitlin,
Here are a couple of options for you:
plot(x = seq(from = as.Date("2011-05-01"), to = as.Date("2011-05-30"),
by = "day"),
y = cumsum(runif(30)))
## using a bit of a shortcut
plot(x = as.Date("2011-05-01") + 0:29,
y = cumsum(runif(30)))
Does that do what you want?
Josh
On Sun, Aug 7, 2011 at 5:00 PM, Caitlin <bioprogrammer at gmail.com> wrote:
> Hi all.
>
> I need to plot 30 values and I'd like the x-axis to have 30 dates values,
> e.g., 5/1/2011, 5/2/2011, etc. so an observer could see how the values
> correspond as the month progresses.
>
> Is there a convenient function I could use? I considered creating two
> vectors, x and y, then simply plotting those.
>
> Thanks,
>
> ~Caitlin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list