Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>1)</strong> Since the times are dates be sure to use <code>"Date"</code> class, not <code>"POSIXct"</code> or <code>"POSIXlt"</code>. See R News 4/1 for advice and try this where <code>Lines</code> is defined in the Note at the end. No packages are used here.</p> <pre><code>dm &lt;- read.table(text = Lines, header = TRUE) dm$Date &lt;- as.Date(dm$Date, "%m/%d/%Y") plot(Visits ~ Date, dm, xaxt = "n", type = "l") axis(1, dm$Date, format(dm$Date, "%b %d"), cex.axis = .7) </code></pre> <p>The use of <code>text = Lines</code> is just to keep the example self-contained and in reality it would be replaced with something like <code>"myfile.dat"</code> . (continued after image)</p> <p><a href="https://i.stack.imgur.com/TmVLb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TmVLb.png" alt="screenshot"></a></p> <p><strong>2)</strong> Since this is a time series you may wish to use a time series representation giving slightly simpler code:</p> <pre><code>library(zoo) z &lt;- read.zoo(text = Lines, header = TRUE, format = "%m/%d/%Y") plot(z, xaxt = "n") axis(1, dm$Date, format(dm$Date, "%b %d"), cex.axis = .7) </code></pre> <p>Depending on what you want the plot to look like it may be sufficient just to use <code>plot(Visits ~ Date, dm)</code> in the first case or <code>plot(z)</code> in the second case suppressing the <code>axis</code> command entirely.</p> <p><strong>Note:</strong></p> <pre><code>Lines &lt;- "Date Visits 11/1/2010 696537 11/2/2010 718748 11/3/2010 799355 11/4/2010 805800 11/5/2010 701262 11/6/2010 531579 11/7/2010 690068 11/8/2010 756947 11/9/2010 718757 11/10/2010 701768 11/11/2010 820113 11/12/2010 645259" </code></pre>
    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. 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.
    3. VO
      singulars
      1. This table or related slice is empty.
    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