Learn R Programming

RCALI (version 0.3.7)

as.poly: Create an object of class 'poly'

Description

Create an object of class "poly" from two vectors or from a matrix.

Usage

as.poly(x, y=NULL)

Value

An object of class "poly", i.e a two-columns matrix labelled "xcoord", "ycoord".

Arguments

x

vector of x-coordinates or two-columns matrix

y

vector of y-coordinates when 'x' is a vector.

See Also

crpoly

Examples

Run this code
# A triangle
a <- as.poly(matrix(c(2,2,2,3,3,3), ncol=2, byrow=TRUE))

Run the code above in your browser using DataLab