-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
od_oneway() replaces the variable names by "o" and "d" #53
Comments
No good reason, this is a bug I think @temospena, thanks for reporting. I suspect it's a quick fix, if so, PR would be very welcome. If not, happy to take a look. |
Ok, I just PR! I added this: od_oneway = function(x,
attrib = names(x[-c(1:2)])[vapply(x[-c(1:2)], is.numeric, TRUE)],
FUN = sum,
...,
id1 = names(x)[1],
id2 = names(x)[2],
oneway_key = NULL) {
...
names(x_oneway)[c(1,2)] = c(id1, id2) # rename columns with original names
...
return(x_oneway)
} It doesn't seem to break up other functions, but please double check. Now it returns the expected output: library(od)
od_min = od_data_df[c(1, 2, 1), 1:4]
names(od_min)
#> [1] "geo_code1" "geo_code2" "all" "train"
### od_oneway with stplar
od_oneway_stplanr = stplanr::od_oneway(od_min)
names(od_oneway_stplanr)
#> [1] "geo_code1" "geo_code2" "all" "train"
### od_oneway with od
od_oneway_od = od::od_oneway(od_min)
names(od_oneway_od)
#> [1] "geo_code1" "geo_code2" "all" "train" Created on 2024-10-07 with reprex v2.1.1 |
I am moving from
stplanr
tood
simply to create desire lines.Is there any (good) reason that the
od::od_oneway()
replaces the origin and destination variable names byo
andd,
instead keeping them, as it happens instplanr::od_oneway()
?Created on 2024-09-08 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: