as_complex: Coerce to complex

Description Usage Arguments Value Examples

Description

Utility function to create complex vectors from arguments specified as in grDevices::xy.coords() or otherwise

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
as_complex(x, y)

## S4 method for signature 'xy,missing'
as_complex(x)

## S4 method for signature 'numeric,numeric'
as_complex(x, y)

## S4 method for signature 'numeric,missing'
as_complex(x, y)

## S4 method for signature 'missing,numeric'
as_complex(x, y)

Arguments

x

A numeric vector or missing, or an object inheriting from class "xy"

y

If x is a numeric an optional numeric vector, or missing. If x or y are missing they are taken as 0, but only one may be missing.

Value

A complex vector specifying 2-dimensional coordinates

Examples

1
2
as_complex(cbind(1:3, 3:1))
as_complex(y = 1:3)  ## real parts all zero

BillVenables/WWRGraphics documentation built on Feb. 1, 2021, 12:13 p.m.