说我有这样一张桌子:
targetSdkVersion
然后我把它变成了一个像这样的tableGrob:
Activity
如何在底部添加一行?
我可以像这样在顶部添加一行:
df1 <- data.frame(x=1,y=1,z=1)
或者像这样的第二行(改变t = 1到t = 2,b = 1到b = 2):
tableGrob(df1,rows = NULL) %>% grid.draw()
但是当我尝试这个时(t = 3和b = 3):
tableGrob(df1,rows = NULL) %>% gtable_add_grob(
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(1,"npc"),
x1 = unit(2,"npc"),
y1 = unit(1,"npc"),
gp = gpar(lwd = 2)),
t = 1, b = 1, l = 1, r = 3) %>% grid.draw()
我收到以下错误:
tableGrob(df1,rows = NULL) %>% gtable_add_grob(
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(1,"npc"),
x1 = unit(2,"npc"),
y1 = unit(1,"npc"),
gp = gpar(lwd = 2)),
t = 2, b = 2, l = 1, r = 3) %>% grid.draw()
此外,这不起作用(t = 2且b = 2,但y0 = 2且y1 = 2):
tableGrob(df1,rows = NULL) %>% gtable_add_grob(
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(1,"npc"),
x1 = unit(2,"npc"),
y1 = unit(1,"npc"),
gp = gpar(lwd = 2)),
t = 3, b = 3, l = 1, r = 3) %>% grid.draw()
有什么想法吗?为什么在底部添加一行的尝试特别失败?
答案 0 :(得分:1)