Landscape-Data-Commons / terradactyl

Tools for using terrestrial core methods data
Other
3 stars 4 forks source link

gap_cover() fails when using by_line = TRUE #103

Closed nstauffer closed 2 years ago

nstauffer commented 2 years ago

When spreading the object gap_summary into its three wide data frames while by_line = TRUE, tidyr::spread() throws the following error: Error in `tidyr::spread()`: ! Each row of output must be identified by a unique combination of keys.

nstauffer commented 2 years ago

Proposed patch changes the gap_summary variable selection step so that when by_line = TRUE, LineKey is included as a variable to keep.

  # Subset the fields we need to output
  if (by_line) {
    gap_summary <- gap_summary %>%
      dplyr::select(PrimaryKey, LineKey, total_line_length, interval, n, length, percent)
  } else {
    gap_summary <- gap_summary %>%
      dplyr::select(PrimaryKey, total_line_length, interval, n, length, percent)
  }
josephbrehm commented 2 years ago

resolved on joe-dev