I'm trying to make plot based on the following data
dt <- data.frame(ValuationDate = seq.Date(as.Date("2014-1-1"),
as.Date("2014-7-1"), by = "month"),
Adjuster = factor(c("Bob","Bob","Sue","Sue","Sue","Sue","Bob")),
Paid = c(1,2,3,4,5,6,7), Incurred = c(3,5,9,9,10,8,7))
dt <- melt(dt, measure.vars = c("Paid", "Incurred"),
variable.name = "Value", value.name = "Amount")
dt
ValuationDate Adjuster Value Amount
1 2014-01-01 Bob Paid 1
2 2014-02-01 Bob Paid 2
3 2014-03-01 Sue Paid 3
4 2014-04-01 Sue Paid 4
5 2014-05-01 Sue Paid 5
6 2014-06-01 Sue Paid 6
7 2014-07-01 Bob Paid 7
8 2014-01-01 Bob Incurred 3
9 2014-02-01 Bob Incurred 5
10 2014-03-01 Sue Incurred 9
11 2014-04-01 Sue Incurred 9
12 2014-05-01 Sue Incurred 10
13 2014-06-01 Sue Incurred 8
14 2014-07-01 Bob Incurred 7
For each ValuationDate, there is a "Paid" amount and an "Incurred" amount which I'd like to plot over time, associating each time period with an Adjuster. When I try doing
#with grouping variable and linetype (error)
ggplot(data = dt) + geom_step(aes(x = ValuationDate,
y = Amount, group = Value,
color = Adjuster, linetype = Value))
I get "Error: geom_path: If you are using dotted or dashed lines, colour, size and linetype must be constant over the line"
However the following two plots work
#with grouping variable, without linetype
ggplot(data = dt) + geom_step(aes(x = ValuationDate, y = Amount,
group = Value, color = Adjuster))

#with linetype, without grouping variable
ggplot(data = dt) + geom_step(aes(x = ValuationDate, y = Amount,
color = Adjuster, linetype = Value))

What gives?

