R中的组合表+甘特图

时间:2016-08-17 15:00:22

标签: r gantt-chart

我知道we can create Gantt Charts in R,但我希望能够创建一个包含5-7行数据的表,然后是右边的甘特图。

df <- structure(list(Position = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("President", 
                                                                            "Vice"), class = "factor"), Name = structure(c(4L, 1L, 3L, 1L, 
                                                                                                                           3L, 2L), .Label = c("Adams", "Burr", "Jefferson", "Washington"
                                                                                                                           ), class = "factor"), correct = c(TRUE, TRUE, TRUE, TRUE, TRUE, 
                                                                                                                                                              TRUE), win = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), start = structure(c(-66021, 
                                                                                                                                                                                                                                            -63153, -61693, -66021, -63153, -61693), class = "Date"), end = structure(c(-63153, 
                                                                                                                                                                                                                                                                                                                        -61693, -58771, -63153, -61693, -58771), class = "Date")), .Names = c("Position", 
                                                                                                                                                                                                                                                                                                                                                                                              "Name", "position", "win", "start", "end"), class = "data.frame", row.names = c(NA, 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              -6L))
df

  Position       Name   correct   win      start        end
1 President Washington     TRUE FALSE 1789-03-29 1797-02-03
2 President      Adams     TRUE FALSE 1797-02-03 1801-02-03
3 President  Jefferson     TRUE FALSE 1801-02-03 1809-02-03
4      Vice      Adams     TRUE FALSE 1789-03-29 1797-02-03
5      Vice  Jefferson     TRUE FALSE 1797-02-03 1801-02-03
6      Vice       Burr     TRUE FALSE 1801-02-03 1809-02-03

所以我想要有位置,名字,正确&amp;赢取作为表中的列,然后向右,显示时间轴的栏。我将如何在R中创建这些?

0 个答案:

没有答案