[R] Table and Sweave
Ista Zahn
istazahn at gmail.com
Wed May 12 16:49:56 CEST 2010
And what exactly is the problem?
-Ista
On Wednesday 12 May 2010 7:32:20 am Silvano wrote:
> Ista,
>
> I have a dataset with 148 observations and 17 variables. I
> used EpiData to create the database
>
> DATANASC SEXO IDADE PESO ESTATURA IMC
> 1955-01-20 F 54.4 136 1.52 58.9
> 1971-04-20 F 38.2 73 1.68 25.9
> 1919-04-25 F 90.2 62 1.58 24.8
> 1943-07-12 F 66.0 65 1.65 23.9
> 1987-08-07 M 21.9 167 1.94 44.4
> 1953-11-10 F 55.6 57 1.50 25.3
> 1973-08-06 F 35.9 49 1.60 19.1
> 1923-12-09 M 85.6 82 1.70 28.4
> 1947-08-25 M 61.8 90 1.75 29.4
> 1957-08-10 F 51.9 98 1.64 36.4
>
> and so on.
>
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
> --------------------------------------
> ----- Original Message -----
> From: "Ista Zahn" <istazahn at gmail.com>
> To: <r-help at r-project.org>
> Cc: "Silvano" <silvano at uel.br>
> Sent: Tuesday, May 11, 2010 5:48 PM
> Subject: Re: [R] Table and Sweave
>
>
> 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