[R] Table and Sweave

Ista Zahn istazahn at gmail.com
Tue May 11 22:48:45 CEST 2010


It would be easier to help if you made your example reproducible (what is 
IDADE and where does it come from?).

-Ista

On Tuesday 11 May 2010 4:22:27 pm Silvano wrote:
> Hi,
> 
> in Latex I get the table using:
> 
> \begin{table}[H]
> \centering
> \renewcommand{\arraystretch}{1.3}
> \setlength{\tabcolsep}{18pt}
> \begin{tabular}{cc}     \hline
> Idade   & Frequência \\ \hline
> $18 \vdash 26$ &   11     \\
> $26 \vdash 34$ &    8     \\
> $34 \vdash 42$ &   26     \\
> $42 \vdash 50$ &   20     \\
> $50 \vdash 58$ &   23     \\
> $58 \vdash 66$ &   30     \\
> $66 \vdash 74$ &   17     \\
> $74 \vdash 82$ &    9     \\
> $82 \vdash 90$ &    2     \\
> $90 \vdash 98$ &    2     \\ \hline
> \end{tabular}
> \end{table}
> 
> I tried get a similar table using Sweave, but it isn't work.
> The commands are:
> 
> <<>>=
> Idade.tb = cut(IDADE,
> breaks=c(18,26,34,42,50,58,66,74,82,90,98), right=F)
> cbind(table(Idade.tb))
> @
> 
> <<idades, echo=F, results=hide>>=
> Idade.tb = cut(IDADE,
> breaks=c(18,26,34,42,50,58,66,74,82,90,98), right=F)
> Idade_freq = cbind(table(Idade.tb))
> medias.idades = tapply(IDADE, SEXO, mean)
> @
> 
> <<idade, echo=F, results=verbatim>>=
> Idade_freq
> @
> 
> or
> 
> <<>>=
> xtable(Idade_freq)
> @
> 
> but they are not the way I want.
> 
> Any suggestions?
> 
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented,
> minimal, self-contained, reproducible code.



More information about the R-help mailing list