Without a reproducible example, it's hard to know for sure what is going on.
You should be able to open a text connection using ?file with the open
argument set to write
. Then, you can capture output and write it to your file using ?write with the append
argument set to TRUE
. The following worked fine on my machine:
> zz <- file(description="some name.txt", open="w")
> isOpen(zz)
[1] TRUE
> for(i in 1:100000){
+ x <- rbeta(1000, shape1=10, shape2=10)
+ write(x, file=zz, append=TRUE)
+ }
> close(zz)
(Note, I wouldn't try running that; it took nearly a half an hour and created a 962 MB file that could only be opened with EditPad.)