[R] latex.table for table with character and numeric columns

Gerrit Draisma g.draisma at erasmusmc.nl
Fri Dec 4 15:29:21 CET 2009


Hallo,
I have a dataset with one or two columns with character data
and the rest with numeric data.
Using latex.table from the quantreg package produced a table,
but I cannot set the decimals.
For instance:
---
 > x<-data.frame(Name=c("Jan","Piet","Jan"), V=c(1,2.991,3))
 > latex.table(as.matrix(x),file="x",caption="x")
 > latex.table(as.matrix(x),file="x",caption="x",dec=2)
Error in round(x, dec) : Non-numeric argument to mathematical function
 >
---
Am I not using the right command, or is there a way around?
Thanks,
Gerrit.




More information about the R-help mailing list