as_ropensci | R Documentation |
Handler for rOpenSci API calls
as_ropensci(httr_res, data = NULL)
httr_res |
httr response object |
data |
Data object from parsing, if any, defaults to NULL if none passed. |
## Not run: library(httr) url <- "http://api.plos.org/search?q=author:Ethan White&rows=1&wt=json" out <- GET(url) data <- content(out) somedata <- data$response$docs[[1]] as_ropensci(out, somedata) # or assign output object to some class class(somedata) <- "newobj" as_ropensci(out, somedata) # get information on a call dat <- as_ropensci(out, somedata) dat$data # the data ouput dat$status_code # the HTTP status dat$status_message # a more meaningful HTTP status message dat$call # the url that was called dat$meta$handle # the url handle dat$meta$headers # headers dat$meta$cookies # cookies dat$meta$config # any configuration settings passed # Pass output to print command, same as not using print pint(dat) dat ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.