[R] sink() output to another directory
Rich Shepard
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Fri Sep 14 00:58:16 CEST 2018
On Thu, 13 Sep 2018, Rich Shepard wrote:
> sink('example-output.txt')
> print(summary(df))
> sink()
Let me expand on this. When the script contains
# Open PDF device to save plot
pdf('../images/rainfall-estacada-se.pdf')
...
plot(rain_est_se)
dev.off()
the file, rainfall-estacada-se.pdf is placed in the images directory, which
is on the same directory level as the one in which the script is being run.
I thought the equivalent syntax with sink() would work, but the print
command rejects the forward slash that plot() accepts:
Error in source("rainfall-dubois-crk-all.r") :
rainfall-dubois-crk-all.r:25:7: unexpected '/'
Is this more clear?
Thanks,
Rich
More information about the R-help
mailing list