[R] (with subject)

Gabor Grothendieck ggrothendieck at gmail.com
Fri Sep 5 01:59:28 CEST 2008


I assume the problem is that you want the axis to have all 12
months but your data is much shorter.  Try this:

mos <- seq(as.Date("2008-01-01"), length = 12, by = "month")
plot(range(mos), range(rawData$y), type = "n", xaxt = "n")
lines(rawData$Date, rawData$y)
axis(1, mos, month.abb)


On Thu, Sep 4, 2008 at 3:15 PM, Dr Eberhard W Lisse <el at lisse.na> wrote:
> Dirk, Gabor,
>
> thanks for your advice, I have now tried to study these
> vignettes, but I must say, as an aging Gynecologist,
> I am facing an enormous learning curve :-)-O.
>
> This works nicely:
>
> rawData <- data.frame(x = c("2008-03-01", "2008-03-21", "2008-03-23",
> "2008-04-08", "2008-04-20", "2008-05-10", "2008-06-20"), y = c(4, 6, 8, 5,
> 7, 2 ,1))
> rawData[,"x"] <- as.Date(rawData[,"x"])
> with(rawData, plot(x, y, main="Some text", type='l'))
>
> How do I make the X-Axis start on 2008-01-01, end on 2008-12-31,
> with tick marks for every month (ie month.abb[1:12] or something
> similar)?
>
> A pointer is enough, weekend is coming up and I am off :-)-O
>
> I also need to add 2 lines statements, but I reckon I can figure that out
> by myself :-)-O
>
>
> greetings, el
> --
> Dr. Eberhard W. Lisse  \        / Obstetrician & Gynaecologist (Saar)
> el at lisse.NA el108-ARIN /   *   |   Telephone: +264 81 124 6733 (cell)
> PO Box 8421             \     / Please send DNS/NA-NiC related e-mail
> Bachbrecht, Namibia     ;____/             to dns-admin at na-nic.com.na
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list