Package bea.r. December 8, 2017

Similar documents
Package datasets.load

Package fitbitscraper

Package oec. R topics documented: May 11, Type Package

Package geniusr. December 6, 2017

Package rzeit2. January 7, 2019

Package canvasxpress

Package validara. October 19, 2017

Package facerec. May 14, 2018

Package repec. August 31, 2018

Package statsdk. September 30, 2017

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package censusapi. August 19, 2018

Package fastdummies. January 8, 2018

Package bigqueryr. June 8, 2018

Package calpassapi. August 25, 2018

Package tidytransit. March 4, 2019

Package robotstxt. November 12, 2017

Package jpmesh. December 4, 2017

Package profvis. R topics documented:

Package jstree. October 24, 2017

Package fst. December 18, 2017

Package bigqueryr. October 23, 2017

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package slickr. March 6, 2018

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package texpreview. August 15, 2018

Package dkanr. July 12, 2018

Package ECctmc. May 1, 2018

Package plumber. December 2, 2017

Package d3plus. September 25, 2017

Package vdiffr. April 27, 2018

Package htmltidy. September 29, 2017

Package rbraries. April 18, 2018

Package darksky. September 20, 2017

Package radix. September 17, 2018

Package SEMrushR. November 3, 2018

Package AutoDeskR. July 10, 2017

Package shiny.semantic

Package promote. November 15, 2017

Package crossword.r. January 19, 2018

Package yhatr. R topics documented: May 9, Type Package Title R Binder for the Yhat API Version Date

Package messaging. May 27, 2018

Package pdfetch. October 15, 2017

Package comparedf. February 11, 2019

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package rnrfa. April 13, 2018

Package PxWebApiData

Package gtrendsr. October 19, 2017

Package routr. October 26, 2017

Package spark. July 21, 2017

Package data.world. April 5, 2018

Package phantasus. March 8, 2019

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package edfreader. R topics documented: May 21, 2017

Package readobj. November 2, 2017

Package pinyin. October 17, 2018

Package strat. November 23, 2016

Package omu. August 2, 2018

Package RPresto. July 13, 2017

Package gtrendsr. August 4, 2018

Package websearchr. R topics documented: October 23, 2018

Package phuse. January 2, 2019

Package internetarchive

Package githubinstall

Package guardianapi. February 3, 2019

Package clipr. June 23, 2018

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package skynet. December 12, 2018

Package utilsipea. November 13, 2017

Package spelling. December 18, 2017

Package opencage. January 16, 2018

Package ecoseries. R topics documented: September 27, 2017

Package fst. June 7, 2018

Package rtext. January 23, 2019

Package nodbi. August 1, 2018

Package sigmanet. April 23, 2018

Package virustotal. May 1, 2017

Package genesysr. June 14, 2018

Package bisect. April 16, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package liftr. R topics documented: May 14, Type Package

Package autoshiny. June 25, 2018

Package patentsview. July 12, 2017

Package weco. May 4, 2018

Package ether. September 22, 2018

Package barcoder. October 26, 2018

Package available. November 17, 2017

Package sfc. August 29, 2016

Package RLumShiny. June 18, 2018

Package aws.transcribe

Package nlgeocoder. October 8, 2018

Package cancensus. February 4, 2018

Package genderizer. July 5, 2015

Package NFP. November 21, 2016

Package milr. June 8, 2017

Package dbx. July 5, 2018

Package rgdax. January 7, 2019

Package IATScore. January 10, 2018

Package DCD. September 12, 2017

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Transcription:

Title Bureau of Economic Analysis API Version 1.0.4 Author Andrea Batch [aut, cre], Jeff Chen [ctb], Walt Kampas [ctb] Depends R (>= 3.2.1), data.table Package bea.r December 8, 2017 Imports httr, DT, shiny, jsonlite, googlevis, shinydashboard, ggplot2, stringr, chron, gtable, scales, htmltools, httpuv, xtable, stringi, magrittr, htmlwidgets, Rcpp, munsell, colorspace, plyr, yaml Provides an R interface for the Bureau of Economic Analysis (BEA) API (see <http://www.bea.gov/api/bea_web_service_api_user_guide.htm> for more information) that serves two core purposes - 1. To Extract/Transform/Load data [beaget()] from the BEA API as R-friendly formats in the user's work space [transformation done by default in beaget() can be modified using optional parameters; see, too, bea2list(), bea2tab()]. 2. To enable the search of descriptive meta data [beasearch()]. Other features of the library exist mainly as intermediate methods or are in early stages of development. Important Note - You must have an API key to use this library. Register for a key at <http://www.bea.gov/api/signup/index.cfm>. URL https://github.com/us-bea/bear License CC0 LazyData no RoxygenNote 6.0.1 NeedsCompilation no Maintainer Andrea Batch <Andrea.Julca@bea.gov> Repository CRAN Date/Publication 2017-12-07 23:58:53 UTC 1

2 bea2list R topics documented: bea2list........................................... 2 bea2tab........................................... 3 beaget............................................ 3 beaparams.......................................... 4 beaparamvals........................................ 5 beasearch.......................................... 6 beasets........................................... 6 beaupdatemetadata..................................... 7 beaviz............................................ 7 Index 9 bea2list Convert BEA API httr response payload to list Convert BEA API httr response payload to list bea2list(beapayload, ismeta = FALSE) beapayload ismeta An object with httr class response from call to BEA API Special parameter meant to interact with metadata functions (default: FALSE) An object of class list of several dimensions. View list structure using str(yourlist). userspeclist <- list('userid' = 'yourkey', resp <- beaget(userspeclist, astable = FALSE) BL <- bea2list(resp)

bea2tab 3 bea2tab Convert BEA API httr response or list payload to data.table Convert BEA API httr response or list payload to data.table. Also, converts LONG data frame (default API format - see bea2list results) to WIDE data (with years as columns) by default bea2tab(beapayload, aswide = TRUE, itablestyle = TRUE) beapayload aswide itablestyle An object of class list or httr response returned from beaget() call to BEA API Return data.table in wide format (default: TRUE) If "aswide = TRUE", setting "itablestyle = TRUE" will return data.table in same format as shown on BEA website, with dates and attributes as column headers and series as rows; otherwise, results have series codes as column headers (default: TRUE) An object of class data.table containing data from beaget(...) with custom attributes(bdt)$params. userspeclist <- list('userid' = 'yourkey', resp <- beaget(userspeclist) BDT <- bea2tab(resp) beaget Pass list of user specifications (including API key) to return data from BEA API. Pass list of user specifications (including API key) to return data from BEA API.

4 beaparams beaget(beaspec, asstring = FALSE, aslist = FALSE, astable = TRUE, aswide = TRUE, ismeta = FALSE, itablestyle = TRUE) beaspec asstring aslist astable aswide ismeta itablestyle A list of user specifications (required). In this example, GetData specifies that we want data values (rather than metadata), NIPA specifies the dataset, A specifies that we want annual data, TableID = 68 gets a specific table, and X gets all years. See BEA API documentation or use metadata methods for complete lists of parameters. Return result body as a string (default: FALSE) Return result body as a list (default: FALSE) Return result body as a data.table (default: TRUE) Return data.table in wide format (default: TRUE) Special parameter meant to interact with metadata functions (default: FALSE) If "aswide = TRUE", setting "itablestyle = TRUE" will return data.table in same format as shown on BEA website, with dates and attributes as column headers and series as rows; otherwise, results have series codes as column headers (default: TRUE) By default, an object of class list of several dimensions. View list structure using str(yourlist). userspeclist <- list('userid' = 'yourapikey', BDT <- beaget(userspeclist, astable = TRUE) beaparams Gives list of parameters possible for a given dataset Gives list of parameters possible for a given dataset beaparams(, setname)

beaparamvals 5 setname Your API key Name of BEA dataset (e.g., NIPA ) A metadata object of class list of several dimensions. View list structure using str(yourlist). beaparams('yourapikey', 'RegionalData') beaparamvals Gives list of values possible for a given dataset s parameters Gives list of values possible for a given dataset s parameters beaparamvals(, setname, paramname) setname paramname Your API key Name of BEA dataset (e.g., NIPA) Name of BEA dataset parameter (e.g., TableID) A metadata object of class list of several dimensions. View list structure using str(yourlist). beaparamvals('yourapikey', 'RegionalData', 'keycode')

6 beasets beasearch Search a selection of indexed BEA data table names, series labels, and series codes. Searches indexed dataset table name, label, and series codes. CAUTION: Currently only works with NATIONAL datasets (NIPA, NIUnderlyingDetail, FixedAssets), temporarily excluding FixedAssets, and REGIONAL datasets (RegionalProduct, RegionalIncome) beasearch(searchterm, = NULL, ashtml = FALSE) searchterm ashtml A word or phrase of class character to be found in BEA datasets Character string representation of user API key. Necessary for first time use and updates; recommended for anything beyond one-off searches from the console. Option to return results as DT markup, viewable in browser. Allows search WITHIN YOUR ALREADY-FILTERED RESULTS ONLY. Requires package DT to be installed. An object of class data.table with information about all indexed sets in which the search term was found. beasearch('gross domestic product', ashtml = TRUE) beasets Returns a list of all datasets Returns a list of all datasets beasets() Your API key

beaupdatemetadata 7 A metadata object of class list of several dimensions. View list structure using str(yourlist). beasets('yourapikey') beaupdatemetadata Download BEA metadata into library/data folder if needed Download BEA metadata into library/data folder if needed beaupdatemetadata(datasetlist, ) datasetlist list of BEA datasets to update local metadata file for (e.g., list( NIPA, FixedAssets )) Your API key Nothing. This updates local.rdata files to be used in beasearch. beaupdatemetadata(list('regionaldata', 'NIPA'), = 'yourapikey') beaviz Visualize BEA API response payload When entered into the R console, the function below starts an interactive dashboard. CAUTION: Currently only works with NATIONAL datasets (NIPA, NIUnderlyingDetail, FixedAs-sets). R Studio users must opt to "show in browser" for this method to be fully functional. beaviz(beapayload = NULL, = NULL)

8 beaviz beapayload An httr response from call to BEA API Your 36-digit BEA API key userspeclist <- list('userid' = 'yourkey', resp <- beaget(userspeclist) BDF <- beaviz(resp) userspeclist <- list('userid' = 'yourkey',

Index Topic metadata beaparams, 4 beaparamvals, 5 beasets, 6 beaupdatemetadata, 7 Topic search beasearch, 6 beaupdatemetadata, 7 bea2list, 2 bea2tab, 3 beaget, 3 beaparams, 4 beaparamvals, 5 beasearch, 6 beasets, 6 beaupdatemetadata, 7 beaviz, 7 9