Вопрос

I've seen similar questions on SO-most of them have not been answered. Those that were answered usually suggest not using xtable since it's not flexible to customization. I've attached two pictures: 1) my generated table from xtable 2) my ideal table. I'd like to add horizontal line to my 1.png dividing it into 3 sections and call sections as Schools, Grades, Students.

1) Does anybody see any possible solution with xtable?

2) Is there any way to read the output of xtable as a list of strings and then modify it by adding some latex code to get the desired table? Have you tried it?

3) Is there any other package that can be used instead of xtable? enter image description here enter image description here

Here are some simulated numbers to work with (let's suppose it's the code for 1.png):

library(xtable)

desc.matrix <- matrix(rep(NA,60),ncol = 4)
colnames(desc.matrix) <- c("Grade 3","Grade 4","Grade 5","Total")
rownames(desc.matrix) <- c("TRT-#Schools","TRT(Enroll>=85%)-#Schools", 
"TRT(Prog>=50%)- #Schools", "TRT(Prog >= 50% & Enroll>=85%)-#Schools",
"Control-#Schools","TRT-#Grades","TRT(Enroll>=85%)-#Grades", 
"TRT(Prog>=50%)-#Grades", "TRT(Prog >= 50% & Enroll>=85%)-#Grades",
"CTRL-#Grades","TRT-#Students","TRT(Enroll>=85%)-#Students", 
"TRT(Prog>=50%)-#Students", "TRT(Prog >= 50% & Enroll>=85%)-#Students",
"CTRL-#Students")

for (i in 1:ncol(desc.matrix)){
   desc.matrix[,i] <- c(1:(nrow(desc.matrix)))
}

xtable(desc.matrix)

I appreciate your help.

Это было полезно?

Решение

Search for xtableGallery.pdf and search within it for hline.after to find an example of how to put your separator lines anywhere you like. If you do ?xtable then go the index at the bottom and then follow the link at the top about vignettes you can find it there too.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top