Dear list,
I have a question about the interaction between R code and Latex language
trough the Sweave function in the package "utils".
What I'm trying to do is to write a report. Contrary to the examples shown in
the Sweave Manual in which table already constructed by R are "exported" on
Latex files, what I would like to do is to build a table in which I combine
text and specific columns of my data frame. I will give you the following
example to be much more clear.
Suppose I have a data frame like this:
Firms Year IIA IIB
IIC
electrolux 1995 100 45
65
electrolux 1996 340 67
97
electrolux 1997 35 99
31
fiat 1995 76
34 45
fiat 1996 567
35 66
fiat 1997 453 89
37
Where IIA is the turnover of the firm, IIB is the production and IIC is the
cost of labour.
I would like to get a table like this in the latex format this:
Firms 1
electrolux
-----------------------------------------------------------------------------------
variables 1995 1997 1997
----------------------------------------------------------------------------------
turnover 100 340 35
production 45 67 99
cost of labour 65 97 31
--------------------------------------------------------------------------------
I use the following code:
\documentclass[a4paper]{article}
\title{example}
\begin{document}
\maketitle
<<echo=F>>=
mydata$firms
@
variables
<<echo=F>>=
mydata$year
@
and so on. I have two problem, first I'm not able to put on the same line text
and output of R. So on my Latex document I get for example
variable
1995 1996 1997
and I don't want this. The secondo problem is that at the beginnig of the R
output I get the index, namely
variable
[1] 1995 1996 1997
and I don't want to see it.
Anyone Knows how to do it or if there is another package in R that give me the
possibility to create a Report by constructing table without any problems???
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.