Skip to main content
added 13 characters in body
Source Link
Nick Kennedy
  • 21.1k
  • 3
  • 17
  • 43

R[R + sp package], 55 bytes

function(x)round(sp::Polygon(x[chull(x),,drop=F])@area)

Try it at RDRR

A function which takes a n x 2 matrix and returns the rounded area. This uses the sp package. The drop=F is needed to handle the one co-ordinate case. RDRR used for demo since TIO lacks the sp package.

R, 55 bytes

function(x)round(sp::Polygon(x[chull(x),,drop=F])@area)

Try it at RDRR

A function which takes a n x 2 matrix and returns the rounded area. This uses the sp package. The drop=F is needed to handle the one co-ordinate case. RDRR used for demo since TIO lacks the sp package.

[R + sp package], 55 bytes

function(x)round(sp::Polygon(x[chull(x),,drop=F])@area)

Try it at RDRR

A function which takes a n x 2 matrix and returns the rounded area. This uses the sp package. The drop=F is needed to handle the one co-ordinate case. RDRR used for demo since TIO lacks the sp package.

Source Link
Nick Kennedy
  • 21.1k
  • 3
  • 17
  • 43

R, 55 bytes

function(x)round(sp::Polygon(x[chull(x),,drop=F])@area)

Try it at RDRR

A function which takes a n x 2 matrix and returns the rounded area. This uses the sp package. The drop=F is needed to handle the one co-ordinate case. RDRR used for demo since TIO lacks the sp package.