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

Issues with FredR #3

Open
amobasheri opened this issue Mar 29, 2015 · 9 comments
Open

Issues with FredR #3

amobasheri opened this issue Mar 29, 2015 · 9 comments

Comments

@amobasheri
Copy link

Hi:

I am fairly new to R but have followed your instructions on devtool installation and I believe successfully installed FredR and have an api key. However when I follow your instructions on fred <- FredR(api.key) I get an error message that FredR function cant be found. Specifically here is what I get:

Installing FredR
"C:/PROGRA1/R/R-311.3/bin/x64/R" --vanilla CMD INSTALL "C:/Users/Ardavan/AppData/Local/Temp/Rtmp2BKcCm/devtools1a00c13091/jcizel-FredR-cef0c9c"
--library="C:/Users/Ardavan/Documents/R/win-library/3.1" --install-tests

  • installing source package 'FredR' ...
    ** R
    ** inst
    ** tests
    ** preparing package for lazy loading
    Warning: replacing previous import by 'dplyr::between' when loading 'FredR'
    Warning: replacing previous import by 'dplyr::last' when loading 'FredR'
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    *** arch - i386
    Warning: replacing previous import by 'dplyr::between' when loading 'FredR'
    Warning: replacing previous import by 'dplyr::last' when loading 'FredR'
    *** arch - x64
    Warning: replacing previous import by 'dplyr::between' when loading 'FredR'
    Warning: replacing previous import by 'dplyr::last' when loading 'FredR'
  • DONE (FredR)

    fred <- FredR(api.key)
    Error: could not find function "FredR"

Can you assist?

@louisdecharson
Copy link

Hi,

I have exactly the same issue !
Did someone have the same and finally found a solution ?
Thanks a lot,

Louis

@mwilliamf
Copy link

I am having the same problem :(, someone please help ;)
fredr_api_help

@mwilliamf
Copy link

Just use:
Sys.setenv(TZ = "UTC")
library(quantmod)
#DependentStockSymbols<-c('SP500','NASDAQCOM','DJIA','WILL5000IND','RU2000PR')
#getSymbols.FRED(DependentStockSymbols)

However, dude to the HTTP -> HTTPS which you must make changes to your code and you cannot use the getSymbols function as of right now.

Some edits I found through StackOverflow...with some of my modifications.

temp = tempfile()
download.file(url='https://research.stlouisfed.org/fred2/series/SP500/downloaddata/SP500.csv', destfile=temp, method='curl')
SP_df<- read.csv(temp,na.string='.')
SP500 <- xts(SP_df[,-1], order.by=as.POSIXct(SP_df$DATE))

Don't worry, I voted the contributor up. Hope the issue gets resolved soon and that this works for you'll!

@khakieconomics
Copy link

Hi - first, thanks for putting this together. Second, the examples on the help page are not working (perhaps a HTTP-> HTTPS thing?).

Getting:

> gdp <- fred$series.observations(series_id = 'GDPC1')
Space required after the Public Identifier
SystemLiteral " or ' expected
SYSTEM or PUBLIC, the URI is missing
Error: 1: Space required after the Public Identifier
2: SystemLiteral " or ' expected
3: SYSTEM or PUBLIC, the URI is missing

@zacharov
Copy link

Hi,

I was able to make things work by not using the library at Github, but by downloading the FredR_Master zip file, and alter the initialization function such that http was replaced by https. That made it work.
The examples on the site are indeed no good, for instance, the first read-out of series containing GDP in their name, has a wrong character in it apparently (paragraph sign instead of dollar sign), but after correcting that, all worked well.
Could you please update the library to correct for the https parameter in the roots variable ?

Thank you in advance !

@hdg786
Copy link

hdg786 commented Oct 5, 2015

hello, i did what you suggested below. Fix("FredR") and then change the root variable to https. I still get the following error.gdp.series <- fred$series.search("GDP")
Error in fred$series.search("GDP") : could not find function "%>>%"
Many Thanks for your help

@aranryan
Copy link

I've tried the fix("FredR") approach, but I can't seem to get it to work for me. It's still trying to load "http://api.stlouisfed.org". I'm open to any suggestions.
I've done fix("FredR") and then edited the http references I see to https, and then save.

@wmatwijec
Copy link

Probably not the best but I got it to work by

  1. In my source code I added library calls referenced in the header of FredR.
    library("FredR")
    library("XML")
    library("RCurl")
    library("data.table")
    library("pipeR")
    library("rlist")
    library("dplyr")

  2. Make the change in FredR from http to https. I copied and added the whole changed FredR function below the libraries so it will overwrite the function defined in the library("FredR"). If you are using RStudio the function FredR can be compressed by the hitting the little triangle in the trough between the line item numbers and the code

  3. Define your api.key api.key="your_key_here"

  4. Fred=FredR(api.key)

  5. str(Fred,1) should now show a list with the numbers of items available for each list element defined

  6. dp.series <- Fred$series.search("GDP") returns 100 different series related to GDP

@aranryan
Copy link

Thanks wmatwijec, I think I'm able to follow these steps.

In the meantime, I stumbled through some other steps that seem to have worked for me:

  1. Deleted FredR from y R library directory

  2. downloaded and edited FredR

  • downloaded zip file of FredR-master from github
  • edited the file FredR-master/R/FredR.R to change http to https
  • in R, ran install("path/FredR")
  1. commented out plyr in my script

Of course, now I've realized that some of my other scripts (borrowed from a fredplot example on github) use a xmlTreeParse function that doesn't work well with https, but I think I've found a fix for that issue on stackoverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants