Message-ID: <CANz9Z_KptOAvASPCBWR1Sx0WzLU2QcQfqJenX36d9Gh979u-Ew@mail.gmail.com>
Date: 2011-08-08T00:06:44Z
From: Joshua Wiley
Subject: Creating a scatterplot with sequential dates on x-axis?
In-Reply-To: <CABDKo+x8eMdX_U+t3gXsVsv8u7BoL3c9zUGey+wQivTbifR4YA@mail.gmail.com>
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/