Note that there are some explanatory texts on larger screens.

plurals
  1. POggplot2 + Date structure using scale X
    primarykey
    data
    text
    <p>I really need help here because I am way beyond lost.</p> <p>I am trying to create a line chart showing several teams' performance over a year. I divided the year into quarters: 1/1/2012, 4/1/12. 8/1/12. 12/1/12 and loaded the csv data frame into R. </p> <pre><code> Month Team Position 1 1/1/12 South Africa 56 2 1/1/12 Angola 85 3 1/1/12 Morocco 61 4 1/1/12 Cape Verde Islands 58 5 4/1/12 South Africa 71 6 4/1/12 Angola 78 7 4/1/12 Morocco 62 8 4/1/12 Cape Verde Islands 76 9 8/1/12 South Africa 67 10 8/1/12 Angola 85 11 8/1/12 Morocco 68 12 8/1/12 Cape Verde Islands 78 13 12/1/12 South Africa 87 14 12/1/12 Angola 84 15 12/1/12 Morocco 72 16 12/1/12 Cape Verde Islands 69 </code></pre> <p>When I try using ggplot2 to generate the graph the fourth quarter 12/1/12 inexplicably moves to the second spot. </p> <pre><code>ggplot(groupA, aes(x=Month, y=Position, colour=Team, group=Team)) + geom_line() </code></pre> <p>I then put this plot into a variable GA in order to try to use scale_x to format the date:</p> <pre><code>GA + scale_x_date(labels = date_format("%m/%d")) </code></pre> <p>But I keep getting this Error:</p> <pre><code>Error in structure(list(call = match.call(), aesthetics = aesthetics, : </code></pre> <p>could not find function "date_format"</p> <p>And if I run this code:</p> <pre><code>GA + scale_x_date() </code></pre> <p>I get this error:</p> <pre><code>Error: Invalid input: date_trans works with objects of class Date only </code></pre> <p>I am using a Mac OS X running R 2.15.2 </p> <p>Please help.</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.
 

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