A complex value in R is defined via the pure imaginary value i.
> z # print the value of z
> class(z) # print the class name of z
The following gives an error as −1 is not a complex value.
Instead, we have to use the complex value −1 + 0i.
An alternative is to coerce −1 into a complex value.