[R] Function in R saving in xls
David Winsemius
dwinsemius at comcast.net
Mon Jun 24 00:34:12 CEST 2013
On Jun 23, 2013, at 1:54 PM, Sérgio Henrique almeida da silva ju wrote:
> I created a program that breaks a database in several other banks. But in
> this program I save this several banks in txt so now I'd like save in xls,
> but I don't know how.
>
> I tried for (nm in Nms) write.table(Res[[nm]], paste(nm, 'xls', sep='.'),
> sep="\t",dec=",",col.names=TRUE, row.names=FALSE, quote=TRUE, na="NA")
>
> but it did not work
>
> decup <- function(dados,var){
>
> require(gdata)
>
> dados <- read.xls("dados.xls")
>
> attach(dados)
>
> Res = split(dados, var)
>
> for (nm in Nms) write.table(Res[[nm]], file=paste(nm, 'txt', sep='.'))
So where did `Nms` come from? And what was the error?
You probably need to separated fields with a character that Excel recognizes such as commas, semi-colons, or <tab>s.
--
David.
> for (nm in Nms) zip(paste(nm,'zip',sep='.'),paste(nm,'xls',sep='.'), zip =
> Sys.getenv("R_ZIPCMD", "zip"))
>
> }
>
>
> --
> Sérgio Henrique Almeida da Silva Junior
> Doutorando em Epidemiologia em Saúde Pública
> Escola Nacional de Saúde Pública Sérgio Arouca - ENSP/FIOCRUZ
> http://lattes.cnpq.br/1611345552843383
> Tel: (21) 68463637
> http://www.linkedin.com/profile/view?id=250437145&trk=tab_pro
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list