complex(length=0, data=NULL, real=0, imaginary=0, modulus=1, argument=0) is.complex(x) as.complex(x)
is.complex returns TRUE if x is of mode "complex", and FALSE otherwise. Its behavior is unaffected by any attributes of x; for example, x could be a complex array.
as.complex returns x if x is a simple object of mode "complex", and otherwise a complex object of the same length as x and with data resulting from coercing the elements of x to mode "complex". Attributes are deleted.
Both the as.complex and is.complex functions are generic; currently there are no methods written for them.
unit.disk <- complex(arg=runif(50, -pi, pi)) #50 random complex numbers, uniform on the unit circle sqrt(as.complex(-5:5)) # shift the phase of a vector zz.shift <- complex(modulus=Mod(zz), argument=Arg(zz)+pi)