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

Solve #370 #371

Merged
merged 2 commits into from Aug 7, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 14 additions & 12 deletions R/print_gbif.R
Expand Up @@ -102,21 +102,23 @@ pastemax <- function(z, type='counts', n=10){

#' @export
print.gbif_data <- function(x, ..., n = 10) {
if (attr(x, "type") == "single") {
cat(rgbif_wrap(sprintf("Records found [%s]", x$meta$count)), "\n")
cat(rgbif_wrap(sprintf("Records returned [%s]", NROW(x$data))), "\n")
cat(rgbif_wrap(sprintf("Args [%s]", pasteargs(x))), "\n")
if (inherits(x$data, "data.frame")) print(x$data) else cat(x$data)
} else if (attr(x, "type") == "many") {
cat(rgbif_wrap(sprintf("Occ. found [%s]", pastemax(x))), "\n")
cat(rgbif_wrap(sprintf("Occ. returned [%s]", pastemax(x, "returned"))), "\n")
cat(rgbif_wrap(sprintf("Args [%s]", pasteargs(x))), "\n")
cat(sprintf("%s requests; First 10 rows of data from %s\n\n", length(x), substring(names(x)[1], 1, 50)))
if (inherits(x[[1]]$data, "data.frame")) print(x[[1]]$data) else cat(x[[1]]$data)
if ("type" %in% names(attributes(x))) {
if (attr(x, "type") == "single") {
cat(rgbif_wrap(sprintf("Records found [%s]", x$meta$count)), "\n")
cat(rgbif_wrap(sprintf("Records returned [%s]", NROW(x$data))), "\n")
cat(rgbif_wrap(sprintf("Args [%s]", pasteargs(x))), "\n")
if (inherits(x$data, "data.frame")) print(x$data) else cat(x$data)
} else if (attr(x, "type") == "many") {
cat(rgbif_wrap(sprintf("Occ. found [%s]", pastemax(x))), "\n")
cat(rgbif_wrap(sprintf("Occ. returned [%s]", pastemax(x, "returned"))), "\n")
cat(rgbif_wrap(sprintf("Args [%s]", pasteargs(x))), "\n")
cat(sprintf("%s requests; First 10 rows of data from %s\n\n", length(x), substring(names(x)[1], 1, 50)))
if (inherits(x[[1]]$data, "data.frame")) print(x[[1]]$data) else cat(x[[1]]$data)
}
} else {
if (inherits(x, "gbif_data")) x <- unclass(x)
attr(x, "type") <- NULL
attr(x, "return") <- NULL
print(x)
print(tibble::as_tibble(x))
}
}
6 changes: 3 additions & 3 deletions revdep/README.md
Expand Up @@ -10,13 +10,13 @@
|collate |English_United States.1252 |
|ctype |English_United States.1252 |
|tz |Europe/Paris |
|date |2019-08-05 |
|date |2019-08-07 |

# Dependencies

|package |old |new |<U+0394> |
|:------------|:--------|:----------|:--|
|rgbif |1.3.0 |1.3.0.9134 |* |
|rgbif |1.3.0 |1.3.3.9110 |* |
|askpass |NA |1.1 |* |
|assertthat |0.2.1 |0.2.1 | |
|backports |NA |1.1.4 |* |
Expand All @@ -35,7 +35,7 @@
|glue |NA |1.3.1 |* |
|gtable |0.3.0 |0.3.0 | |
|httpcode |0.2.0 |0.2.0 | |
|httr |NA |1.4.0 |* |
|httr |NA |1.4.1 |* |
|jsonlite |1.6 |1.6 | |
|labeling |0.3 |0.3 | |
|lazyeval |0.2.2 |0.2.2 | |
Expand Down