79141517

Date: 2024-10-30 14:30:29
Score: 1
Natty:
Report link

I found an alternative solution specifically for shapefiles:

### shapefile
library(sf)

# extract the bounding box of the shapefile
bbox <- st_bbox(map)

# calculate the aspect ratio
aspect_ratio <- (bbox$ymax - bbox$ymin) / (bbox$xmax - bbox$xmin)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: SusannaB