Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread Barry Rowlingson
On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does not work the same way as is.character() or

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread Duncan Murdoch
On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread peter dalgaard
On 10 May 2014, at 12:54 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects *

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-10 Thread David Winsemius
On May 10, 2014, at 3:54 AM, Duncan Murdoch wrote: On 10/05/2014, 6:46 AM, Barry Rowlingson wrote: On Fri, May 9, 2014 at 10:42 PM, Hadley Wickham h.wick...@gmail.com wrote: Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Bert Gunter
Spencer: Hmmm Well, I don't get what's going on here -- as.character.default is internal -- but could you method-ize a simple synonym: asChar- function(e,...)UseMethod(asChar) asChar.call - function(e,...)deparse(e,...) asChar.default - function(e,...)as.character(e,...) asChar(xDy) [1]

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Duncan Murdoch
On 09/05/2014, 2:41 AM, Bert Gunter wrote: Spencer: Hmmm Well, I don't get what's going on here -- as.character.default is internal -- but could you method-ize a simple synonym: See ?InternalMethods: For efficiency, internal dispatch only occurs on objects, that is those for which

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Bert Gunter
Ahhh. Thanks Duncan. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Fri, May 9, 2014 at 2:41 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Spencer Graves
Hi, Duncan: Thanks very much. I used to think that everything in R was a object. Now I know that is.object(quote(x)) is FALSE. (A decade ago, S-Plus asked me if I wanted to save changes to history. I thought, Wow! Do I get to change history? Hadley's Advanced R book

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Hadley Wickham
Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does not work the same way as is.character() or is.integer() * is.Date() doesn't exist * is.nan() doesn't return TRUE for some NaNs

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-09 Thread Spencer Graves
Dear Hadley: Thanks for that. Digits are not numbers. Numbers are not data. Data is not information. Information is not intelligence. Intelligence is not knowledge. Knowledge is not wisdom. And your is. warnings are more useful than my trivia here. Spencer On 5/9/2014

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-08 Thread Spencer Graves
as.character.call seems not to work as an alias for deparse. Consider the following: xDy - quote(x$y) class(xDy) call as.character.call - function(x, ...)deparse(x, ...) as.character(xDy) [1] $ x y # fails str(xDy) # language x$y as.character.language - function(x, ...)language

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-08 Thread Bert Gunter
[1] x$y Spencer: Does deparse(substitute(x$y)) [1] x$y do what you want? Cheers, Bert -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Thu, May

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-08 Thread Spencer Graves
On 5/8/2014 8:05 PM, Bert Gunter wrote: [1] x$y Spencer: Does deparse(substitute(x$y)) [1] x$y do what you want? No: The problem is methods dispatch. class(quote(x$y)) = 'call', but as.character(quote(x$y)) does NOT go to as.character.call. deparse(quote(x$y)) returns

[R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-07 Thread Spencer Graves
Hello, All: Is there a simple utility someplace to convert quote(x$y) to x$y? I ask, because as.character(quote(x$y)) is a character vector of length 3 = $ x y. I want to convert this to x$y for a diagnostic message. class(quote(x$y)) = call, which suggests I could

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-07 Thread Richard M. Heiberger
deparse(quote(x$y)) [1] x$y On Wed, May 7, 2014 at 5:23 PM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: Hello, All: Is there a simple utility someplace to convert quote(x$y) to x$y? I ask, because as.character(quote(x$y)) is a character vector of length 3 =

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-07 Thread Greg Snow
deparse(quote(x$y)) [1] x$y It looks like deparse does what you want here. On Wed, May 7, 2014 at 3:23 PM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: Hello, All: Is there a simple utility someplace to convert quote(x$y) to x$y? I ask, because

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-07 Thread Bert Gunter
... and str(quote(x$y)) language x$y as.list(quote(x$y)) [[1]] `$` [[2]] x [[3]] y ## may be instructive. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H.

Re: [R] as.character(quote(x$y) ) = $ x y not x$y?

2014-05-07 Thread Spencer Graves
Thanks for the quick replies from Richard Heiberger, Greg Show Bert Gunter. Might it make sense to create as.character.call as an alias for deparse? A few years ago, I wrote several functions like predict.fd as aliases for functions with less memorable names like