Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the output of <code>dput(Corl)</code> we don't have to guess at how the Date values are stored in Corl. As you can see below, the Dates are stored as class = "Date". That makes this fairly easy.</p> <pre><code>library(zoo) Corl &lt;- structure(list(Date = structure(c(15155, 15064, 14974, 14882, 14790, 14699), class = "Date"), Survey = c(60L, 55L, 48L, 48L, 56L, 57L), Actual = c(NA, 50L, 44L, 36L, 75L, 41L)), .Names = c("Date", "Survey", "Actual"), row.names = c(NA, -6L), class = "data.frame") Corl.zoo &lt;- read.zoo(Corl, FUN=as.yearqtr) Corl.zoo Survey Actual 2010 Q1 57 41 2010 Q2 56 75 2010 Q3 48 36 2010 Q4 48 44 2011 Q1 55 50 2011 Q2 60 NA plot(Corl.zoo) </code></pre> <p><img src="https://i.stack.imgur.com/m32dV.jpg" alt="enter image description here"></p> <p>Edit 1 ======================================================</p> <p>Before you ask, here's a way to add vertical grid lines and more labels across the x axis. All I did was modify the example code at the bottom of the following link:</p> <p><a href="http://rss.acs.unt.edu/Rdoc/library/zoo/html/plot.zoo.html" rel="nofollow noreferrer">http://rss.acs.unt.edu/Rdoc/library/zoo/html/plot.zoo.html</a></p> <pre><code>my.panel &lt;- function(...) { lines(...) #This line adds the vertical grid lines abline(v=time(Corl.zoo), col="lightgray", lty=3) panel.number &lt;- parent.frame()$panel.number # if bottom panel if (!length(panel.number) || panel.number == NCOL(Corl.zoo)) { # next line only if non-labelled ticks wanted for each point axis(1, at = time(Corl.zoo), lab = FALSE) labcou &lt;- 1 #Put a label, counting between labels ix &lt;- seq(1, length(Corl.zoo), labcou) labs &lt;- format(time(Corl.zoo), "%Y\nQ%q\n ") axis(1, at = time(Corl.zoo)[ix], lab = labs[ix], tcl = -0.5, padj=0.6, cex.axis = 1) } } plot(Corl.zoo, panel = my.panel, xaxt = "n", main="My Title", xlab="") </code></pre> <p><img src="https://i.stack.imgur.com/kIwhL.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload