[R] xtable with vector

Benilton Carvalho bcarvalh at jhsph.edu
Mon Jul 30 17:27:11 CEST 2007


a <- matrix(1:6, nr=1)
colnames(a) <- paste("col", 1:6)
xtable(a)


On Jul 28, 2007, at 12:39 PM, Stefan Nachtnebel wrote:

> Hello,
>
> Is there a possibility to use xtable with a vector to generate a latex
> table? I always get an error, that no applicable method is available.
>
> For example:
>
> b<-1:12
> dim(b)<-c(2,6)
> dimnames(b)[[2]]<-paste("col",1:6)
> xtable(b)
>
> works fine and does not raise an error, but
>
> a<-1:6
> names(a)<-paste(col,1:6)
> xtable(b)
>
> does not work.
>
> Regards, Stefan



More information about the R-help mailing list