-
Notifications
You must be signed in to change notification settings - Fork 41
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
Merge pull request #4 from us-bea/master #5
base: master
Are you sure you want to change the base?
Conversation
update dev
Hi @Hamed51, BEA's API has a new method, "GetParameterValuesFiltered", for getting the values you can enter for a given parameter, filtering for a selection of the other parameters you would like to pass. A higher-level wrapper for this method hasn't been incorporated into the bea.R library yet, but you can pass a beaGet() request with parameters to give you possible values. In the case of your specific query, where you want to find the possible LineCode values given that you are looking for table SA51, you would want to use something like the following: lcSpecs <- list(
'UserID' = beaKey,
'Method' = 'GetParameterValuesFiltered',
'Datasetname' = 'RegionalIncome',
'TableName' = 'SA51',
'TargetParameter' = 'LineCode'
)
lcResp <- beaGet(lcSpecs, asTable = F, asList = T, isMeta = T)
lcResp$ParamValue
Where the variable "beaKey" is a character string with your 36-digit BEA API key. "lcResp$ParamValue" will be a table with a "Key" column (the value you should enter in your user specifications list, as "LineCode" = [the key you want]) and a "Desc" column (a description of what that line code refers to). In this case, your lcResp$ParamValue should be:
In future versions bea.R, we will add a method for retrieving this information that is more comparable to the existing "beaParamVals()" function (see Thanks for letting us know about this! If you have any follow-up questions or issues, feel free to comment with them here. For more information about the "GetParameterValuesFiltered" method, check the "Methods" tab of our API manual |
Hi Andrea,
Thank youvery much for your detailed respond to my question. I am new to bea.R API .
I hadtried to retrieve the linecode by beaParamValsfunction before you sent your respond. It was a bit messy to get the result (for me). But the method , 'GetParameterValuesFiltered', that you introduced help me a lot.
When approximately the future Bea.R will release? Where I canfollow to know the date and time.
Thank you,
Hamed
On Wednesday, March 14, 2018, 12:37:52 PM PDT, Andrea Julca Batch <notifications@github.com> wrote:
Hi @Hamed51,
BEA's API has a new method, "GetParameterValuesFiltered", for getting the values you can enter for a given parameter, filtering for a selection of the other parameters you would like to pass.
A higher-level wrapper for this method hasn't been incorporated into the bea.R library yet, but you can pass a beaGet() request with parameters to give you possible values.
In the case of your specific query, where you want to find the possible LineCode values given that you are looking for table SA51, you would want to use something like the following:
`
lcSpecs <- list(
'UserID' = beaKey,
'Method' = 'GetParameterValuesFiltered',
'Datasetname' = 'RegionalIncome',
'TableName' = 'SA51',
'TargetParameter' = 'LineCode'
)
lcResp <- beaGet(lcSpecs, asTable = F, asList = T, isMeta = T)
lcResp$ParamValue
`
Where the variable "beaKey" is a character string with your 36-digit BEA API key.
"lcResp$ParamValue" will be a table with a "Key" column (the value you should enter in your user specifications list, as "LineCode" = [the key you want]) and a "Desc" column (a description of what that line code refers to).
In future versions bea.R, we will add a method for retrieving this information that is more comparable to the existing "beaParamVals()" function (see ?beaParamVals).
Thanks for letting us know about this! If you have any follow-up questions or issues, feel free to comment with them here. For more information about the "GetParameterValuesFiltered" method, check the "Methods" tab of our API manual
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Whenever I release a patch or update, I create a new release version in this repository. You can watch the repository by going to the main repo page and selecting the "Watch" option in the upper right corner in your browser. Since I create a new version at the same time as my CRAN submission, this means you can keep an eye out for a new version on the CRAN page; the R core team is really fast about approving updates to packages--typically it happens within a few days (barring any major issues with the new version). |
@DreaJulca Error: lexical error: invalid character inside string. i could not access to data whenever i try to get. is it related to R or server. could you advise me how to get the data? Thank You |
|
@DreaJulca
Hello,
I got Real Value Added by Industry by creating this request ::indus <- list(
'UserID' = mykey,
'Method' = 'GetData',
'Datasetname' = 'GDPbyIndustry',
"TableID"='10',
'Frequency' = 'Q',
"Year"="All",
"Industry"="All"
)
beaGet(indus, asTable = F, asList = T, isMeta = T).
I have been trying to get Real Gross Output by Industry data by changing the TableID to 208 ("TableID"='208'), but i got this error::
Error: lexical error: invalid character inside string.
series, divided by 100. Because the formula for the c
(right here) ------^
i could not access to data whenever i try to get. is it related to R or server. could you advise me how to get the data?
Thank You
|
On Wednesday, March 14, 2018, 12:37:52 PM PDT, Andrea Julca Batch <notifications@github.com> wrote:
Hi @Hamed51,
BEA's API has a new method, "GetParameterValuesFiltered", for getting the values you can enter for a given parameter, filtering for a selection of the other parameters you would like to pass.
A higher-level wrapper for this method hasn't been incorporated into the bea.R library yet, but you can pass a beaGet() request with parameters to give you possible values.
In the case of your specific query, where you want to find the possible LineCode values given that you are looking for table SA51, you would want to use something like the following:
`
lcSpecs <- list(
'UserID' = beaKey,
'Method' = 'GetParameterValuesFiltered',
'Datasetname' = 'RegionalIncome',
'TableName' = 'SA51',
'TargetParameter' = 'LineCode'
)
lcResp <- beaGet(lcSpecs, asTable = F, asList = T, isMeta = T)
lcResp$ParamValue
`
Where the variable "beaKey" is a character string with your 36-digit BEA API key.
"lcResp$ParamValue" will be a table with a "Key" column (the value you should enter in your user specifications list, as "LineCode" = [the key you want]) and a "Desc" column (a description of what that line code refers to).
In future versions bea.R, we will add a method for retrieving this information that is more comparable to the existing "beaParamVals()" function (see ?beaParamVals).
Thanks for letting us know about this! If you have any follow-up questions or issues, feel free to comment with them here. For more information about the "GetParameterValuesFiltered" method, check the "Methods" tab of our API manual
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi @Hamed51 , Looks like there's a carriage return in a new reference notes in the API response, and it seems that jsonlite (a dependency of bea.R) can't handle it because it is breaking the JSON into multiple lines within a string element. I'll see if there is anything we can do about removing carriage returns from our API responses (or, barring that, patch bea.R), but in the meantime, here's a workaround: #Get the response without any conversion
lcResp <- beaGet(indus, asTable = F)
#Remove carriage return in response string, convert back to raw bytes
lcResp$content <- charToRaw(gsub('[\r\n]', '', content(lcResp, as='text')))
#Convert response to data.table using bea.R::bea2Tab()
indData <- bea2Tab(lcResp)
Thanks for bringing this to my attention! |
Hello,
Thank you very much. It worked perfectly and saved my time.
Best,
On Friday, March 23, 2018, 3:19:20 PM PDT, Andrea Julca Batch <notifications@github.com> wrote:
Hi @Hamed51 ,
Looks like there's a carriage return in a new reference notes in the API response, and it seems that jsonlite (a dependency of bea.R) can't handle it because it is breaking the JSON into multiple lines within a string element.
I'll see if there is anything we can do about removing carriage returns from our API responses (or, barring that, patch bea.R), but in the meantime, here's a workaround:
#Get the response without any conversion
lcResp <- beaGet(indus, asTable = F)
#Remove carriage return in response string, convert back to raw bytes
lcResp$content <- charToRaw(gsub('[\r\n]', '', content(lcResp, as='text')))
#Convert response to data.table using bea.R::bea2Tab()
indData <- bea2Tab(lcResp)
Thanks for bringing this to my attention!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I am a new user of the bea.R API, with RStudio. I can successfully retrieve NIPA tables, but I have been unable to retrieve the GDPbyIndustry table(s) that were released for the first time by BEA on September 30, 2020 (Table 12 in the NIPA press release in particular). I cannot seem to get the beaSpec right. It says "The dataset requested requires parameters that were missing from the request." When I tried the GetParameterValuesFiltered method, it said "The GetParameterValuesFiltered method has not been implemented on this dataset (coming soon)." Is there a way to retrieve the GDPbyIndustry table? Philip |
@DreaJulca
Hello,
I am starting to use Bea API for R. i am trying to get data from Regional Income
Method' = 'GetData',
'Datasetname' = 'RegionalIncome',
'GeoFips'='STATE',
'TableName' = 'SA51',
'Year' = 'ALL',
'ResultFormat' = 'json'
and this the error that i get:$BEAAPI$Results
$BEAAPI$Results$Error
$BEAAPI$Results$Error$APIErrorCode
[1] "40"
$BEAAPI$Results$Error$APIErrorDescription
[1] "The dataset requested requires parameters that were missing from the request."
$BEAAPI$Results$Error$AdditionalDetail
$BEAAPI$Results$Error$AdditionalDetail$MissingParameter
$BEAAPI$Results$Error$AdditionalDetail$MissingParameter$ParameterName
[1] "LineCode"
$BEAAPI$Results$Error$AdditionalDetail$MissingParameter$ParameterDescription
[1] "Line code for a statistic or industry"
could you help me how i get the line code? or in general , how to solve this problem?
thank you,