I've created a chart with times that employees have entered data on named tasks
as in the following example:
Employee <- c(rep("Tom", 127),
rep("Dick", 121),
rep("Sally", 130)
)
Time <- c(seq(as.POSIXct("2011-09-12 07:00:00"), as.POSIXct("2011-09-12
14:00:00"), 200),
seq(as.POSIXct("2011-09-12 07:00:00"), as.POSIXct("2011-09-12 14:00:00"), 210),
seq(as.POSIXct("2011-09-12 07:05:00"), as.POSIXct("2011-09-12 13:55:00"), 190)
)
Task <- c(rep("Task A", 56), rep("Task B", 27), rep("Task C", 44),
rep("Task A", 22), rep("Task D", 99),
rep("Task B", 44), rep("Task E", 26), rep("Task F", 38), rep("Task G", 22)
)
Schedule <- data.frame(Employee, Time, Task)
require(lattice)
ticks = seq(as.POSIXct("2011-09-12 06:30:00"),
as.POSIXct("2011-09-12 14:30:00"), by = '30 min')
marks = c("", "07:00", "", "08:00", "", "09:00", "",
"10:00", "", "11:00", "", "12:00", "", "13:00", "", "14:00", "")
dotplot(Employee ~ Time, group = Task, data = Schedule, xlab = "",
horizontal = TRUE, scales = list(x = list(at = ticks, labels = marks, cex =
0.4), cex = 0.5), cex = 0.5)
I would like to label the tasks in the chart, i.e. have a left aligned label
above each new task. This would mean plotting the data from
aggregate(Schedule$Time, by = list(Schedule$Employee, Schedule$Task), min)
How do I do this? A legend becomes unwieldy when there are many tasks and
employees.
Any help would greatly be appreciated.
Regards
Mikkel
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.