[R] export only if data is available

Mat matthias.weber at fnt.de
Fri Feb 8 08:49:29 CET 2013


Hello together,

i have a problem with an export.
I want to export a data.frame, only if there ist data in it.
My data.frame (CO.PHB) ist empty but with this code, the .txt-file gets
exported every time, with no content.

{
pfad<-paste(paste(paste("C:/Test/","Reminder",sep=""),
"Orders",sep="/"),"txt",sep=".")
write.xls( Orders,pfad,colNames = TRUE,sheet = 1,from = 1,rowNames = FALSE )
if(dim(CO.PHB)[1]>0){
write.table( CO.PHB,pfad,row.names=FALSE,sep=" | ")
}}

how should my code look like, if i want only an Export, when there is data
in the data.frame?

Thanks Mat



--
View this message in context: http://r.789695.n4.nabble.com/export-only-if-data-is-available-tp4657922.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list