Skip to content
Prev 255639 / 398506 Next

converting "call" objects into character

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

            
fTest<-function(x)

{  theCall<-match.call()
       print(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'
David Winsemius, MD
West Hartford, CT