Skip to content

Instantly share code, notes, and snippets.

@nutterb
Last active April 8, 2016 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nutterb/8a5e39544df395f6f4198e520580a80f to your computer and use it in GitHub Desktop.
Save nutterb/8a5e39544df395f6f4198e520580a80f to your computer and use it in GitHub Desktop.
A LaTeX safe approach to applying borders to all cells using pixiedust
medley_all_border <- function(x, part = c("table"))
{
part <-
match.arg(part,
c("table", "head", "body", "interfoot", "foot"),
several.ok = TRUE)
part <-
if ("table" %in% part)
{
c("head", "body", "interfoot", "foot")
}
for (i in part)
{
if (!is.null(x[[i]]))
{
part_rows <- max(x[[i]][["row"]])
part_cols <- max(x[[i]][["col"]])
x <- sprinkle(x,
rows = 1:part_rows,
cols = 1:part_cols,
border = c("left", "bottom"),
part = i)
x <- sprinkle(x,
rows = 1,
border = "top",
part = i)
x <- sprinkle(x,
cols = part_cols,
border = "right",
part = i)
}
}
x
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment