Skip to content

Commit

Permalink
feat: allow submitting coords/data as tibbles
Browse files Browse the repository at this point in the history
see #128
  • Loading branch information
rCarto committed May 2, 2024
1 parent e0623fa commit e9d8a8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ input_table <- function(x, id) {
call. = FALSE
)
}
if (ncol(x) == 2 && is.numeric(x[, 1]) && is.numeric(x[, 2])) {
if (ncol(x) == 2 && is.numeric(x[, 1, drop = TRUE]) && is.numeric(x[, 2, drop = TRUE])) {
rn <- row.names(x)
if (is.null(rn)) {
rn <- 1:lx
}

x <- data.frame(
id = rn,
lon = clean_coord(x[, 1]),
lat = clean_coord(x[, 2])
lon = clean_coord(x[, 1, drop = TRUE]),
lat = clean_coord(x[, 2, drop = TRUE])
)
return(x)
} else {
Expand Down Expand Up @@ -251,9 +251,9 @@ input_route <- function(x, id, single = TRUE, all.ids = FALSE) {
if (lx < 2) {
stop('"loc" should have at least 2 rows.', call. = FALSE)
}
if (ncol(x) == 2 && is.numeric(x[, 1]) && is.numeric(x[, 2])) {
lon <- clean_coord(x[, 1])
lat <- clean_coord(x[, 2])
if (ncol(x) == 2 && is.numeric(x[, 1, drop = TRUE]) && is.numeric(x[, 2, drop = TRUE])) {
lon <- clean_coord(x[, 1, drop = TRUE])
lat <- clean_coord(x[, 2, drop = TRUE])
rn <- row.names(x)
if (is.null(rn)) {
rn <- 1:lx
Expand Down

0 comments on commit e9d8a8b

Please sign in to comment.