[R] sink() not working as expected
Ivan Krylov
kry|ov@r00t @end|ng |rom gm@||@com
Tue Nov 2 22:21:21 CET 2021
On Tue, 2 Nov 2021 10:18:07 -0700 (PDT)
Rich Shepard <rshepard using appl-ecosys.com> wrote:
> 'corvalis discharge summary\n'
> summary(cor_disc)
> sd(cor_disc$cfs)
> '-----------------\n'
In the interactive mode, on the top level of execution, these commands
behave as if you had written
print(sink('data-summaries.txt'))
print('corvalis discharge summary\n')
print(summary(cor_disc))
print(sd(cor_disc$cfs))
instead. When you source() a script, auto-printing is not performed.
This is explained in the first paragraph of ?source, but not ?sink. If
you want to source() scripts and rely on their output (including
sink()), you'll need to print() results explicitly.
--
Best regards,
Ivan
More information about the R-help
mailing list