Wednesday, November 27, 2013

Something to Think About Before Black Friday | rChart + dygraphs

US Retail stocks have been killing it.  Since the holiday season starting with Black Friday is so important to retail, let’s look at the US Retail industry price and Sharpe ratio using R rCharts and Performance analytics +  javascript dygraphs.  Thanks Kenneth French once again for the dataset.



  1. Hi, really great post as per usual. However, I'm having some difficulty replicating. Specifically, it is a similiar error as previous posts with regards the library structure:

    Error in file(con, "r") : cannot open the connection

    In addition: Warning message:

    In file(con, "r") :

    cannot open file '/config.yml': No such file or directory

    I amusing the dev branch and read through all previous posts to no avail.
    Could you shed some light on what exactly setLib is expecting.


  2. Sorry that it did not work for you. I forgot to change the line in the code to use the web to get the structure rCharts expects. I have changed the setLib line now to

    dy1$setLib( "" )

    Please try this and see if it works for you.

    This link by the rCharts author might help explain the structure if you want to work from a local directory.

  3. Sorry for the slow response. Unfortunately, I was unable to replicate your example exactly. I believe you're missing a lib reference in the second graphic setup. However, I built my own version locally without issue.

    I'm now investigating the following; rbbg->rcharts->shiny, in close to real-time if possible. If you had any pointers or other interesting references it would be appreciated. Also, on a side note, it appears rCharts gallery page is not loading correctly - no charts appear regardless of options selected.


  4. Great to hear that you got it working. Have you made any progress on the rbbg -> rCharts? Believe it or not I still have not tried rbbg even thought I love R and have Bloomberg. I would love some extra motivation to get it set up.

  5. I still get the same error (Error in file(con, "r") : cannot open the connection), even if I use the reference to the url you provided:

    dy1$setLib( "" )

    Can you confirm that the url is right?

    Shouldn't we then be able to view the config.yml file in:

    (which return 404 not found)

    Can you provide at least a url to download a local version of your "rCharts_dygraph" library? That would allow others to replicate at least with local access to the downloaded library.

    Thanks in advanced!

  6. "I built my own version locally without issue."
    Can you share that local version, so that others can try at least locally?
    Thanks in advanced

  7. Sorry, I should have made it clearer. Whenever you see or similar pattern, you can go to to see the entire github repo. As to your error, I am guessing you have an outdated rCharts. This is in very active development. I would suggest doing


    Please let me know if this does not work. Thanks for reading.