[R] sink() not working as expected

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Wed Nov 3 20:21:53 CET 2021

On Wed, 3 Nov 2021, Ivan Krylov wrote:

> 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.


I've read ?source and still do not understand where to put either auto-print
or an explicit print statement. For example,
cor_disc %>%
     select(site_nbr,year, mon, day, hr, min, tz, cfs) %>%
             sampdt = make_datetime(year, mon, day, hr, min)

throws an error. I also get an error when the print statement follows the
sampdt assignment.

I need to understand how to get a sourced file that's modified (as these
tibbles are by combining data and time columns into a datatime colune) and
saving the tibble with the new appended column.


More information about the R-help mailing list