[R] Function in R saving in xls

Rui Barradas ruipbarradas at sapo.pt
Mon Jun 24 00:04:04 CEST 2013


Hello,

To work with xls files, check out package XLConnect. The vignette 
explains how to use it rather well.

Also, don't use attach() It can be confusing and a source for errors.

Hope this helps,

Rui Barradas

Em 23-06-2013 21:54, Sérgio Henrique almeida da silva ju escreveu:
> 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='.'))
>
> for (nm in Nms) zip(paste(nm,'zip',sep='.'),paste(nm,'xls',sep='.'), zip =
> Sys.getenv("R_ZIPCMD", "zip"))
>
> }
>
>
>
>
> ______________________________________________
> 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