insert a column into a tabular object

I found this blog on getting a nested table into LaTeX format[(Blog Link)](http://www.r-statistics.com/2012/01/printing-nested-tables-in-r-bridging-between-the-reshape-and-tables-packages/). I like the outcome but want to insert a column into the object at the beginning after the rownames. I'm used to dealing with data frames so dealing with this beast is more difficult than typical column indexing. Here's what I have now: pre post approach mean sd mean sd 1 24.17 8.310 54.33 11.01 2 25.50 9.434 65.25 16.32 3 26.33 9.139 63.17 12.53 And here's what I'd like it to look like: pre post approach n mean sd mean sd 1 12 24.17 8.310 54.33 11.01 2 12 25.50 9.434 65.25 16.32 3 12 26.33 9.139 63.17 12.53 Here's the dput of z and also the column of n's I'd like to insert. Thank you in advance. z <- structure(list(24.1666666666667, 25.5, 26.3333333333333, 8.31027111835746, 9.4339811320566, 9.13866245766587, 54.3333333333333, 65.25, 63.1666666666667, 11.0068848977136, 16.3157759685081, 12.5323822978956), .Dim = 3:4, .Dimnames = list( NULL, c("term", "term", "term", "term")), rowLabels = structure(c("1", "2", "3"), .Dim = c(3L, 1L), .Dimnames = list(NULL, "approach"), justification = structure(c(NA_character_, NA_character_, NA_character_), .Dim = c(3L, 1L)), colnamejust = NA_character_, justify = NA, suppress = 0), colLabels = structure(c("pre", "mean", NA, "sd", "post", "mean", NA, "sd"), .Dim = c(2L, 4L), justification = structure(c(NA_character_, NA_character_, NA_character_, NA_character_, NA_character_, NA_character_, NA_character_, NA_character_), .Dim = c(2L, 4L)), colnamejust = character(0), justify = NA, suppress = 0), table = value * v * approach ~ variable2 * result_variable, formats = structure(c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), .Dim = 3:4, .Dimnames = list( NULL, c("format", "format", "format", "format"))), justification = structure(c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), .Dim = 3:4, .Dimnames = list( NULL, c("justification", "justification", "justification", "justification"))), class = "tabular") structure(c(12L, 12L, 12L), .Names = c("1", "2", "3"))
I'd like to actually understand the structure of this for future needs.

以上就是insert a column into a tabular object的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏