Re: [R] converting "call" objects into character

From: David Winsemius <>
Date: Sun, 03 Apr 2011 12:42:20 -0400

On Apr 3, 2011, at 12:14 PM, Samuel Le wrote:

> Dear all,
> I would like to log the calls to my functions. I am trying to do
> this using the function


{ theCall<

       return(list(x=x, logf = theCall))


 > fTest(x=2)$x
[1] 2
 > fTest(x=2)$logf
fTest(x = 2)
 > str(fTest(x=2)$logf)
  language fTest(x = 2)

You may want to convert that call component to a character object, since:

 > cat(fTest(x=2)$logf)
Error in cat(list(...), file, sep, fill, labels, append) :

   argument 1 (type 'language') cannot be handled by 'cat'

> I can see "theCall" printed into the console, but I don't manage to
> convert it into a character to write it into a log file with other
> informations.
> Can anyone help?

David Winsemius, MD
West Hartford, CT mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 03 Apr 2011 - 16:45:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 03 Apr 2011 - 17:50:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive