Hi,
I am trying to append tables on file with this sample code:
for(i in 1:2){
mat <- data.frame(sample(1:30,9),3,3)
colnames(mat) <- letters[1:3]
ifelse(i ==
1,write.table(mat,paste('test.txt',sep=''),row.names=F),
write.table(mat,paste('test.txt',sep=''),row.names=F,col.names=F,append=TRUE))
}
However, this gives an error:
"Error in ifelse(i == 1, write.table(mat, paste("test.txt", sep = ""), :
replacement has length zero"
- Should I be passing in some other parameters or using a different
function to append tables to file?
thanks!
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.