-
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
Use vec_interleave()
#45
Comments
I think using |
Weird thing: I'm hitting an error message after switching to it, will double check... |
I think od returns a dataframe. Maybe you need to use vec_interleave() + as.data.frame() |
Robinlovelace
added a commit
that referenced
this issue
Sep 30, 2023
That's what I've got: od_coordinates_ids = function(odc) {
res = vctrs::vec_interleave(odc[, 1:2], odc[, 3:4])
res = data.frame(id = rep(1:nrow(odc), each = 2), x = res[, 1], y = res[, 2])
res
} |
It's something about NA values. |
Previous one for reference: od_coordinates_ids = function(odc) {
res = data.frame(id = rep(1:nrow(odc), each = 2), x = NA, y = NA)
ids_odd = seq(1, nrow(res), by = 2)
ids_even = ids_odd + 1
res[ids_odd, c("x", "y")] = odc[, 1:2]
res[ids_even, c("x", "y")] = odc[, 3:4]
res
} |
Error:
|
OK problem found: as you say, |
Robinlovelace
added a commit
that referenced
this issue
Sep 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See ropensci/stplanr#544
The text was updated successfully, but these errors were encountered: