I have a table containing three columns: two types of time (planned time vs really spent time) and a number marking a month (but for each month there is a ton of entries). It looks like that
month planned spent
1 40 30
1 20 20
2 10 NA
etc.
I'm interesting in the percent of spent regarding the planned (and to check if there is a correlation between the quantity of planned time and the percent of spent time). Of course I can count it for each month using:
100*sum(final$spent[final$month == 1], na.rm = T)/sum(final$planned[final$month == 1])
Now I want to build a plot. Planned time is one axis, percent is another one, while the month would be specified with a colour.
I'm trying to do it in lattice with
with(final, xyplot(sum(planned) ~ 100*sum(spent, na.rm = T)/sum(planned), group=month))
but I get only one point on my plot.
I need advice as to how to do it. Thank you.