jcizel / FredR

FredR: R Interface to Federal Reserve Economic Data API
http://www.jankocizel.com/FredR/
Other
58 stars 34 forks source link

Issues with FredR #3

Open amobasheri opened 9 years ago

amobasheri commented 9 years ago

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:/PROGRA~1/R/R-31~1.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

Can you assist?

louisdecharson commented 9 years ago

Hi,

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

Louis

mwilliamf commented 9 years ago

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

mwilliamf commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

3) 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.