[R] print.xtable suppress my row.names
n.vialma at libero.it
n.vialma at libero.it
Fri Jul 9 17:21:04 CEST 2010
Dear list,
someone knows why the print.xtable doesnt print row.names? I dident do
anything with the options.....may depends on the size of my table???
This is my code:
\documentclass[a4paper]{article}
\title{SCHEMA DI BILANCIO PER SINGOLE AZIENDE}
\begin{document}
\maketitle
\hline
<<echo=F>>=
library(xtable)
library(plyr)
rep=Bilanci
rep$SPA<-as.numeric(NA)
rep$SPP<-as.numeric(NA)
rep$CE<-as.numeric(NA)
rep$IN<-as.numeric(NA)
rep$VA<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,PROD=EC01+EC02+EC03)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,VP=rev(rev(PROD)*c(rev(PROD ^
(-1)),0)[-1]))
rep$CTOT<-Bilanci$AA01+Bilanci$AA03+Bilanci$AA04
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,CIRCOL=c(NA,rev(rev(AA03)*0.
5+c(rev(AA03)*0.5,NA)[-1])[-1])+c(NA,rev(rev(AA04)*0.5+c(rev(AA04)*0.5,NA)[-1])
[-1])+c(NA,rev(rev(AL04)*0.5+c(rev(AL04)*0.5,NA)[-1])[-1]))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE01=(EC04-EC05)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE02=EC06/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE03=EC07/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE07=(EC11A+EC11C)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,MOL=100+IE07-IE01-IE02-IE03)
rep$IR<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,ROI=((PROD-EC04+EC05-EC06-
EC07+EC11C+EC11A-EC08)*c(NA,(rev(rev(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))
[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,RNC=((EC12)*c(NA,(rev(rev
(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,EBIT=ROI+RNC)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,RF=((EC10-EC09)*c(NA,(rev(rev
(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,ROE=((EC14)*c(NA,(rev(rev
(AL01)*0.5+c(rev(AL01)*0.5,NA)[-1])^(-1))[-1])*100))
rep$CC<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC01=(CIRCOL/PROD)*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC02=c(NA,rev(rev(AA03)*0.5+c
(rev(AA03)*0.5,NA)[-1])[-1])/PROD*365)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC03=c(NA,rev(rev(AA04)*0.5+c
(rev(AA04)*0.5,NA)[-1])[-1])/EC01*365)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC04=c(NA,rev(rev(AL04)*0.5+c
(rev(AL04)*0.5,NA)[-1])[-1])/(EC04+EC06)*365)
rep$ES<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IF04=(EC14+EC08)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN03=c(NA,rev(rev(AA01)*0.5+c
(rev(AA01)*0.5,NA)[-1])[-1])/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN04=c(NA,rev(rev(CTOT)*0.5+c
(rev(CTOT)*0.5,NA)[-1])[-1])/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN05=AA02/AA07*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN07=AL01/AL06*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN08=AL05/AL06*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN09=IN08/IN07)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN10=((EC09)*c(NA,(rev(rev
(AL05)*0.5+c(rev(AL05)*0.5,NA)[-1])^(-1))[-1])*100))
rep1=subset(rep,select=c(RAGSOCB,CFISCALE,ANNO,SPA,AA01,AA01I,AA01M,AA02,AA02B,
AA02L,AA03,AA04,AA05,AA06,AA07,SPP,AL01,AL02,AL03,AL04,AL04A,AL04B,AL05,AL05B,
AL05L,AL99,AL06,CE,EC01,EC02,EC03,EC04,EC05,EC06,EC07,EC08,EC08A,EC08B,EC09,
EC10,EC11,EC11A,EC11C,EC12,EC13,EC14,EC15,EC16,IN,VA,PROD,CTOT,CIRCOL,MOL,IR,
ROI,RNC,EBIT,RF,ROE,CC,IC01,IC02,IC03,IC04,ES,IF04,IN03,IN04,IN05,IN07,IN08,
IN09,IN10))
mynames<-names(rep1)
mynames[mynames=="SPA"]<-"STATO_PATRIMONIALE_ATTIVO"
mynames[mynames=="AA01"]<-"Immobilizzazioni_tecniche_nette"
mynames[mynames=="AA01I"]<-"Immobilizzazioni_imm_nette"
mynames[mynames=="AA01M"]<-"Immobilizzazioni_mat_nette"
mynames[mynames=="AA02"]<-"Partecipazioni e crediti fin"
mynames[mynames=="AA02B"]<-"Attivita fin a breve"
mynames[mynames=="AA02L"]<-"Immobilizzazioni finan"
mynames[mynames=="AA03"]<-"Magazzino"
mynames[mynames=="AA04"]<-"Crediti commerciali"
mynames[mynames=="AA05"]<-"Liquidita"
mynames[mynames=="AA06"]<-"Altre attivita"
mynames[mynames=="AA07"]<-"Tot attivita"
mynames[mynames=="SPP"]<-"STATO PATRIMONIALE PASSIVO"
mynames[mynames=="AL01"]<-"Capitale netto"
mynames[mynames=="AL02"]<-"Fondo tfr"
mynames[mynames=="AL03"]<-"Altri fondi"
mynames[mynames=="AL04"]<-"Debiti commerciali"
mynames[mynames=="AL04A"]<-"Anticipi di clienti"
mynames[mynames=="AL04B"]<-"Debiti vs fornitori"
mynames[mynames=="AL05"]<-"Debiti fin tot"
mynames[mynames=="AL05B"]<-"Debiti fin a breve"
mynames[mynames=="AL05L"]<-"Debiti fin a medio lungo"
mynames[mynames=="AL99"]<-"Altre passivita"
mynames[mynames=="AL06"]<-"Tot passivita"
mynames[mynames=="CE"]<-"CONTO ECONOMICO"
mynames[mynames=="EC01"]<-"Ricavi netti"
mynames[mynames=="EC02"]<-"Produzione int capitalizzate"
mynames[mynames=="EC03"]<-"Variazione scorte prod finiti"
mynames[mynames=="EC04"]<-"Acquisti"
mynames[mynames=="EC05"]<-"Variazioni scorte mat prime"
mynames[mynames=="EC06"]<-"Costi per servizi god beni terzi"
mynames[mynames=="EC07"]<-"Costo del lavoro tot"
mynames[mynames=="EC08"]<-"Ammortamenti e accantonamenti"
mynames[mynames=="EC08A"]<-"Ammortamenti"
mynames[mynames=="EC08B"]<-"Accantonamenti e utilizzi di riserve"
mynames[mynames=="EC09"]<-"Oneri fin"
mynames[mynames=="EC10"]<-"Proventi fin"
mynames[mynames=="EC11"]<-"Ricavi diversi netti"
mynames[mynames=="EC11A"]<-"Altri ricavi netti ord"
mynames[mynames=="EC11C"]<-"Contributi conto esercizio"
mynames[mynames=="EC12"]<-"Proventi straord netti"
mynames[mynames=="EC13"]<-"Imposte"
mynames[mynames=="EC14"]<-"Utile netto rettificato"
mynames[mynames=="EC15"]<-"Rettifiche"
mynames[mynames=="EC16"]<-"Utile esercizio"
mynames[mynames=="IN"]<-"INDICATORI DI BILANCIO"
mynames[mynames=="VA"]<-"Voci aggregate"
mynames[mynames=="PROD"]<-"Produzione"
mynames[mynames=="VP"]<-"Produzione (var%)"
mynames[mynames=="CTOT"]<-"Capitale Totale"
mynames[mynames=="CIRCOL"]<-"Capitale circolante netto"
mynames[mynames=="IR"]<-"Indici di redditività"
mynames[mynames=="RNC"]<-"Redditivita gestione straordinaria"
mynames[mynames=="RF"]<-"Redditivita finanziaria"
mynames[mynames=="CC"]<-"Il Capitale circolante"
mynames[mynames=="IC01"]<-"Capitale circolante Netto(%prod)"
mynames[mynames=="IC02"]<-"Giorni magazzino"
mynames[mynames=="IC03"]<-"Giorni clienti"
mynames[mynames=="IC04"]<-"Giorni fornitori"
mynames[mynames=="IF04"]<-"Cash flow"
mynames[mynames=="ES"]<-"Elementi strutturali"
mynames[mynames=="IN03"]<-"Intensita Capitale fisso"
mynames[mynames=="IN04"]<-"Intensita Capitale operativo"
mynames[mynames=="IN05"]<-"Part a att finan(%tot att)"
mynames[mynames=="IN07"]<-"Giorni fornitori"
mynames[mynames=="IN08"]<-"Giorni fornitori"
mynames[mynames=="IN09"]<-"Leverage"
mynames[mynames=="IN10"]<-"Costo medio ind finanz"
names(rep1)<-mynames
rm(rep)
repo=split(rep1,rep1$CFISCALE)
repor=lapply(repo,function(x){
t(x)})
@
<<echo=F,results=tex>>=
report<-lapply(repor, function(x) {
print(xtable(x),floating.environment="sidewaystable",size="\\small")})
@
\end{document}
THIS HAPPEN AFTER ADDING THIS PART OF THE CODE:
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,CIRCOL=c(NA,rev(rev(AA03)*0.
5+c(rev(AA03)*0.5,NA)[-1])[-1])+c(NA,rev(rev(AA04)*0.5+c(rev(AA04)*0.5,NA)[-1])
[-1])+c(NA,rev(rev(AL04)*0.5+c(rev(AL04)*0.5,NA)[-1])[-1]))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE01=(EC04-EC05)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE02=EC06/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE03=EC07/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IE07=(EC11A+EC11C)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,MOL=100+IE07-IE01-IE02-IE03)
rep$IR<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,ROI=((PROD-EC04+EC05-EC06-
EC07+EC11C+EC11A-EC08)*c(NA,(rev(rev(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))
[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,RNC=((EC12)*c(NA,(rev(rev
(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,EBIT=ROI+RNC)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,RF=((EC10-EC09)*c(NA,(rev(rev
(CTOT)*0.5+c(rev(CTOT)*0.5,NA)[-1])^(-1))[-1])*100))
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,ROE=((EC14)*c(NA,(rev(rev
(AL01)*0.5+c(rev(AL01)*0.5,NA)[-1])^(-1))[-1])*100))
rep$CC<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC01=(CIRCOL/PROD)*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC02=c(NA,rev(rev(AA03)*0.5+c
(rev(AA03)*0.5,NA)[-1])[-1])/PROD*365)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC03=c(NA,rev(rev(AA04)*0.5+c
(rev(AA04)*0.5,NA)[-1])[-1])/EC01*365)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IC04=c(NA,rev(rev(AL04)*0.5+c
(rev(AL04)*0.5,NA)[-1])[-1])/(EC04+EC06)*365)
rep$ES<-as.numeric(NA)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IF04=(EC14+EC08)/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN03=c(NA,rev(rev(AA01)*0.5+c
(rev(AA01)*0.5,NA)[-1])[-1])/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN04=c(NA,rev(rev(CTOT)*0.5+c
(rev(CTOT)*0.5,NA)[-1])[-1])/PROD*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN05=AA02/AA07*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN07=AL01/AL06*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN08=AL05/AL06*100)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN09=IN08/IN07)
rep<-ddply(rep,c("CFISCALE","RAGSOCB"),transform,IN10=((EC09)*c(NA,(rev(rev
(AL05)*0.5+c(rev(AL05)*0.5,NA)[-1])^(-1))[-1])*100))
rep1=subset(rep,select=c(RAGSOCB,CFISCALE,ANNO,SPA,AA01,AA01I,AA01M,AA02,AA02B,
AA02L,AA03,AA04,AA05,AA06,AA07,SPP,AL01,AL02,AL03,AL04,AL04A,AL04B,AL05,AL05B,
AL05L,AL99,AL06,CE,EC01,EC02,EC03,EC04,EC05,EC06,EC07,EC08,EC08A,EC08B,EC09,
EC10,EC11,EC11A,EC11C,EC12,EC13,EC14,EC15,EC16,IN,VA,PROD,CTOT,CIRCOL,MOL,IR,
ROI,RNC,EBIT,RF,ROE,CC,IC01,IC02,IC03,IC04,ES,IF04,IN03,IN04,IN05,IN07,IN08,
IN09,IN10))
AND THEN I GET ALSO THIS ERROR MESSAGE:
Warning message:
In data.row.names(row.names, rowsi, i) :
some row.names duplicated: 71,72 --> row.names NOT used
But when I run my just my R code without use the Sweave function the message
doesnt appear.
I think its something wrong with the second chunk.
Thanks a lot for your help!!!
More information about the R-help
mailing list