Error from hydroloom::align_names() after updating to new nhdplusTools
Closed this issue · 2 comments
Hi --- I'm running into a new error in a workflow that was previously functioning with nhdplusTools 0.7.1. I am now using nhdplusTools version 1.2.0.
I am encountering the following error when I call get_partial_length()
:
Error in hydroloom::align_names(hydro_location) :
Problem aligning names. COMID conflicts with hydroloom name id can't proceed converting to hy object.
I'm having trouble interpreting this error message, so I'm hoping you can clarify what's going wrong.
I have isolated a small example which reproduces the error:
# subset of the data
hydro_location <- data.frame('id' = 1,
'COMID' = 55000100670556,
'reachcode' = 17100103006692,
'reach_meas' = 26.7784,
'offset' = 4.23888650687e-05,
'lat' = 46.551898126,
'lon'= -123.346933787) %>%
sf::st_as_sf(.,
coords = c("lon", "lat"),
crs = 4269)
# minimum example of the error
hydroloom::align_names(hydro_location)
# what I'm actually trying to do
# (lines is a sfc of NHDplusHR data from HUC 170010)
# nhdplusTools::get_partial_length(hydro_location, lines)
Thanks for any help you can provide.
Thanks for the thorough report. The hydroloom
package tries to convert COMID
to id
-- since you have id
in the dataset, it bombs.
Quick fix is to change your id
to some other attribute.
Bigger fix is for hydroloom to handle id
more elegantly.
Thank you for your quick response! I think in this case it should be pretty easy to rename the id column.