Error in data.frame(zipcode_a, zipcode_b, distance) : arguments imply differing number of rows: 32019, 400.
I am attempting to calculate the distance between 32019 Zip Codes and one location (Zipcode 94063). I have an excel sheet with two columns. Both columns are vectorized and have lengths of 32019 but I keep getting an error that the arguments imply differing number of rows when running zip_distance(Zip_Codes_Only$zip_a, zip_Codes_Only$zip_b, units = "miles").
Does anyone have a fix for this or an alternative method to calculate distance between zip codes? I have tried mapdist but also run into similar issues.
Wow, this package has a some undocumented features which conflict with the help pages. These functions are not vectorized and thus one is required to loop through the dataset line-by-line to obtain the correct answer.
Example of the logic error generated by the trying to process a vector with the
zip_distance()
function. As per the help page:Notice zip_d is a reverse ordering of zip_c but the distance vector in the resulting data frame is the same.