# NOT RUN {
#*** Example 1: Simple Table
tab.text <- lazy.table(mtcars[, c(1, 2, 4, 6)], align="right",
cborder=c(0, 4), rborder=c(0, nrow(mtcars)))
lazy.write(
lazy.file.start(),
tab.text,
lazy.file.end(),
OutFile="Example 1.tex")
unlink("Example 1.tex")
#*** Example 2: Complex Table
person <- c("Rachel", "John", "Elizabeth", "George", "Ryan")
veg <- c("", "x", "x", "", "x")
meat <- c("x", "", "", "x", "")
soup <- c("x", "", "x", "x", "")
salad <- c("", "x", "", "", "x")
ice <- c("", "x", "x", "x", "")
cake <- c("x", "", "", "", "x")
dinner <- cbind(person, veg, meat, soup, salad, ice, cake)
colnames(dinner) <- c("Name", "Vegetarian", "Meat",
"Soup", "Salad", "Ice Cream", "Cake")
tab1 <- lazy.table(c("", "Entree", "Side", "Dessert"),
cspan=c(1, 2, 2, 2),
rborder=c(0, 0, 1), rbspan=2:7,
caption="Dinner Orders", close=FALSE)
tab2 <- lazy.table(colnames(dinner),
align=c("left", rep("center", 6)),
cborder=c(3, 5),
open=FALSE, close=FALSE)
tab3 <- lazy.table(dinner,
align=c("left", rep("center", 6)),
cborder=c(1, 3, 5),
rborder=c(0, nrow(dinner)), open=FALSE)
lazy.write(
lazy.file.start(),
tab1, tab2, tab3,
lazy.file.end(),
OutFile="Example 2.tex")
unlink("Example 2.tex")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab