I can't get table with Hmisc::latex
and sapply
function. latex
return many tables. I would like to use a Hmisc::latex
because it more flexible configurable.
Steps to reproduce problem:
library(xtable)
library(Hmisc)
library(nortest)
set.seed(1)
x <- matrix(rnorm(10*100), nrow=100)
norm.x <- sapply(x, sf.test)[1:2,]
latex(norm.x, file="", dec=2)
xtable(norm.x) # In contrast xtable produce pretty output
Edit:
Solution (thanks to Sven Hohenstein):
library(Hmisc)
library(nortest)
set.seed(1)
x <- matrix(rnorm(10*100), nrow=100)
norm.x <- sapply(x, function(z) unlist(sf.test(z)[c("statistic", "p.value")]))
latex(norm.x, file="", dec=2)