Search code examples
rggplot2summarize

Summarized Data isn't showing up in ggplot when i graph it


I have data that I have summarized into weekly arrival amounts. When I go to graph the data, I ggplot doesn't the line for weight.

```{r} weightedbyweek = weightedbydate %>% 
group_by(arrival = cut.Date(RECV_DATE, "week")) %>% 
summarise( w = sum(weightdays)) 
```
ggplot(weightedbyweek, aes(x = arrival, y = w))+ 
  geom_line()

All that shows up is the chart with no line for the data in w. I have checked the weightedbyweek data from and there is data for w, which is in difftime.


Solution

  • cut.Date produces a factor by default. I suspect as.integer(arrival) in the aes will fix it.