I have a table that I want to display that contains a combination of percent, integer and floating point values in different rows of the table.
I would like to create formatted output in an R markup or Rnw file that displays my table well.
I can do this based on the column if I use the xtable command and the numbers command.
I researched the use of the print.dll.to.row function in LaTeX output, however I cannot find the LaTeX tag that will apply the format to my numbers, all of them will require brackets around individual numbers for the formatting to take effect, and I don’t I can achieve this.
<<results=tex>>=
library(xtable)
X<-data.frame();
for (i in 1:2) {
r<-sample(1:1000,4);
X<-rbind(X,r);
}
X<-rbind(X,(X[1,]/(X[1,]+X[2,])))
colnames(X)<-c("Cat A","Cat B","Cat C","Cat D")
rownames(X)<-c("Passed","Failed","Percent Passed")
formTable<-xtable(X)
print(formTable)
Y=t(X)
Y[,"Percent Passed"]=Y[,"Percent Passed"]*100;
formatedTab<-xtable(Y)
digits(formatedTab)<-c(0,0,0,2)
print(formatedTab)
@
If I could carry the output of the second table, I would be happy ... but this does not work.
, , , , .