[R] sink() within a function?

Duncan Murdoch murdoch at stats.uwo.ca
Wed Jun 1 19:22:42 CEST 2005


Jon Stearley wrote:
> On Jun 1, 2005, at 10:23 AM, Rolf Turner wrote:
> 
>>foo<-function(x,f) { sink(f); print(format(x)); sink(); }
> 
> 
> many thanks!  doh ;)
> 
> ?format is unclear on return value imho.

?format does describe the return value, though in the Details section 
rather than in Value:

      These functions convert their first argument to a vector (or
      array) of character strings which have a common format (as is done
      by 'print'), fulfilling 'length(format*(x, *)) == length(x)'.  The
      trimming with 'trim = TRUE' is useful when the strings are to be
      used for plot 'axis' annotation.

I'll try to make it clearer.

Duncan Murdoch




More information about the R-help mailing list