Hi R,
I am trying to get an output like this
Hi
Hello
1 a b
2 a b
3 a b
4 a b
5 a b
And write it as a text file
cat(paste("Hi",sep='\n',"Hello")) gives me
Hi
Hello
And when I try
cat(paste("Hi",sep='\n',"Hello"),sep='\n',data.frame(rep("a",3),rep("b",
3))) I get an error!
Thanks in advance for your help!
Regards
Ravi
This e-mail may contain confidential and/or privileged i...{{dropped:13}}
Ravi S. Shankar <ravis <at> ambaresearch.com> writes:> I am trying to get an output like this > Hi > Hello > 1 a b# The easy way: good for logging of results, but commands print too, # depending how you run it df = data.frame(a=rep("a",3),b=rep("b",3)) sink(file="a.txt") cat("Hello\n") print(df) sink() # a bit better cat("Hello\n",file="b.txt") write.table(df,file="b.txt",append=TRUE,col.names=FALSE, row.names=FALSE,quote=FALSE) Dieter