Re: [Rd] formals() adds 0 to complex function arguments

2014-01-20 Thread Hadley Wickham
On Sun, Jan 19, 2014 at 3:16 PM, peter dalgaard wrote: > It's not formals() that is doing you in. Rather, it is a conspiration between > two things: > (a) R always displays complex constants as x+yi, even if x is zero and (b) > there really is no way to specify complex constants with non-zero r

Re: [Rd] formals() adds 0 to complex function arguments

2014-01-20 Thread peter dalgaard
On 20 Jan 2014, at 00:00 , Duncan Murdoch wrote: >>> >>> Someone might want to fix this by implementing a full syntax for complex >>> constants, but meanwhile, I think a passable workaround could be >> >> That might be nice to do. Not sure if it's easy or hard... > > I think it's hard. Afte

Re: [Rd] formals() adds 0 to complex function arguments

2014-01-19 Thread baptiste auguie
Thank you Peter and Duncan, for the explanation and discussion. As for a workaround, I think it is more readable to define, test <- function(a = complex(real=1, imaginary=2)){} Best regards, baptiste On 19 January 2014 18:45, Duncan Murdoch wrote: > On 14-01-19 4:16 PM, peter dalgaard wrote

Re: [Rd] formals() adds 0 to complex function arguments

2014-01-19 Thread Duncan Murdoch
On 14-01-19 4:45 PM, Duncan Murdoch wrote: On 14-01-19 4:16 PM, peter dalgaard wrote: It's not formals() that is doing you in. Rather, it is a conspiration between two things: (a) R always displays complex constants as x+yi, even if x is zero and (b) there really is no way to specify complex c

Re: [Rd] formals() adds 0 to complex function arguments

2014-01-19 Thread Duncan Murdoch
On 14-01-19 4:16 PM, peter dalgaard wrote: It's not formals() that is doing you in. Rather, it is a conspiration between two things: (a) R always displays complex constants as x+yi, even if x is zero and (b) there really is no way to specify complex constants with non-zero real part, i.e. 1+2

Re: [Rd] formals() adds 0 to complex function arguments

2014-01-19 Thread peter dalgaard
It's not formals() that is doing you in. Rather, it is a conspiration between two things: (a) R always displays complex constants as x+yi, even if x is zero and (b) there really is no way to specify complex constants with non-zero real part, i.e. 1+2i is a sum of a real and and imaginary compl