Hi user I have a question about export files. I run my program for different countries and different years. For export files I do this in SAS: (1) Path to data files %let teste=C:\Documents and Settings\MEALQ\My Documents; (2) Country code; %let cc=pt; (3) Survey year; %let yy=03; Output in: &teste\&cc\&yy\cc&yy.txt How can I do a similar command in R? Thanks in advance, Ana Quiterio Lisbon/Portugal [[alternative HTML version deleted]]
Ita.Cirovic-Donev@hypo-alpe-adria.com
2006-Feb-13 15:01 UTC
[R] export files - write.table
for write.table in R I use the following: # table to be stored in excel for example sum.stat <- data.frame(sum.stat) # data to be stored write.table(sum.stat, file="D:/..../my_table.xls", sep="\t", dec=",", row.names=TRUE, col.names=TRUE, qmethod="double")
Ana, the following code may help: teste="P:/test" cc="pt" yy="03" data=matrix(1:12,3,4) dir=paste(teste,cc,yy,sep="/") # does directory already exist? if not, then create it if (!is.null(try(setwd(dir),silent=TRUE))) {dir.create(dir,recursive=T)} # write data to desired location write.table(data,file=paste(dir,"/",cc,yy,".txt",sep="")) cheers, marcus> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ana Quit??rio > Sent: Monday, February 13, 2006 3:27 PM > To: r-help at stat.math.ethz.ch > Subject: [R] export files - write.table > > Hi user > > I have a question about export files. > > I run my program for different countries and different years. > > > > For export files I do this in SAS: > > > > (1) Path to data files > > %let teste=C:\Documents and Settings\MEALQ\My Documents; > > > > (2) Country code; > > %let cc=pt; > > > > (3) Survey year; > > %let yy=03; > > > > Output in: &teste\&cc\&yy\cc&yy.txt > > > > How can I do a similar command in R? > > > > Thanks in advance, > > > > Ana Quiterio > > Lisbon/Portugal > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >