Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

r - sf multipolygon Error: C stack usage is too close to the limit

I have a very similar problem to this question: GenomicRanges: C stack usage ... is too close to the limit

I'm receiving the error message that "C stack usage is too close to the limit" when I try to view a multipolygon shapefile that I've imported.

Most of the help with this error message relates to recursive functions, but if that is what is happening, I don't think it's my doing. Viewing an sf polygon normally is not an issue.

ranges <- st_read("Range maps/PRISM_shorebird_ranges_breeding", "PRISM_shorebird_ranges_breeding")
> View(ranges)
Error: C stack usage  40945840 is too close to the limit
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error: C stack usage  40945840 is too close to the limit
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

However, the object seems fine when I try to look at the data in other ways.

str(ranges)

Classes ‘sf’ and 'data.frame':  40 obs. of  7 variables:
 $ binomial  : chr  "Arenaria interpres" "Arenaria interpres" "Arenaria interpres" "Calidris alpina" ...
 $ presence  : num  1 1 1 1 1 1 1 1 1 1 ...
 $ origin    : num  1 1 1 1 1 1 1 1 1 1 ...
 $ seasonal  : num  1 2 2 2 1 2 1 2 2 2 ...
 $ dist_comm : chr  NA NA NA NA ...
 $ Shape_Area: num  4.92 272.49 424.3 200.75 7.66 ...
 $ geometry  :sfc_MULTIPOLYGON of length 40; first list element: List of 477
  ..$ :List of 1
  .. ..$ : num [1:762, 1:2] 8.99 8.99 9 9 8.98 ...
  ..$ :List of 1
     
........


  ..$ :List of 1
  .. ..$ : num [1:24, 1:2] 11.2 11.2 11.3 11.3 11.3 ...
  ..$ :List of 1
  .. ..$ : num [1:18, 1:2] 6.42 6.43 6.44 6.44 6.44 ...
  .. [list output truncated]
  ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
 - attr(*, "sf_column")= chr "geometry"
 - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA
  ..- attr(*, "names")= chr [1:6] "binomial" "presence" "origin" "seasonal" ...



ranges[1,]

Simple feature collection with 1 feature and 6 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: 4.650085 ymin: 58.53088 xmax: 12.91248 ymax: 65.57788
geographic CRS: NAD83
            binomial presence origin seasonal dist_comm Shape_Area                       geometry
1 Arenaria interpres        1      1        1      <NA>   4.915708 MULTIPOLYGON (((8.985718 63...

I also don't think the object should be too big

object.size(ranges)
93727840 bytes (~95kb)

The solution in GenomicRanges: C stack usage ... is too close to the limit was that there were packages that hadn't been updated due to permission issues.

I too have some R packages in "C:/Program Files/R/R-4.0.3/library" that I cannot update because I don't have administrative privileges. Nor will I be able to change this, as it's a work computer.

Any suggestions as to how I might resolve this problem?

question from:https://stackoverflow.com/questions/66053563/sf-multipolygon-error-c-stack-usage-is-too-close-to-the-limit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...