Skip to content
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

Changed to rbind.fill from the plyr package to make this work #38

Merged
merged 3 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion R/get_inat_obs.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @param day Return observations only on a given day of the month, 1...31
#' @param bounds A bounding box of longitude (-180 to 180) and latitude (-90 to 90) to search
#' within. It is a vector in the form of southern latitude, western longitude, northern latitude,
#' and eastern longitude.
#' and eastern longitude. Alternatively supply a sf object.
#' @param maxresults The maximum number of results to return. Should not be
#' a number higher than 10000.
#' @param meta (logical) If TRUE, the output of this function is a list with metadata on the output
Expand Down Expand Up @@ -117,6 +117,10 @@ get_inat_obs <- function(query = NULL, taxon_name = NULL, taxon_id = NULL,
}

if(!is.null(bounds)){
if(inherits(bounds,"sf")){
bounds_prep <- as.vector(sf::st_bbox(bounds))
bounds <- c(swlat = bounds_prep[2], swlng = bounds_prep[1], nelat = bounds_prep[4], nelng = bounds_prep[3] );rm(bounds_prep)
}
if(length(bounds) != 4){stop("Bounding box specifications must have 4 coordinates.")}
search <- paste0(search, "&swlat=", bounds[1], "&swlng=", bounds[2],
"&nelat=", bounds[3], "&nelng=", bounds[4])
Expand Down
2 changes: 1 addition & 1 deletion R/get_inat_obs_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ get_inat_obs_project <- function(grpid, type = c("observations", "info"), raw =
obs_list[[i]] <-
fromJSON(content(GET(url1), as = "text"), flatten = TRUE)
}
project_obs <- do.call("rbind", obs_list)
project_obs <- do.call("rbind.fill", obs_list)
return(project_obs)
}
}