3.2 What we’ll cover
- Quick interactive graphs with the quantmod and dygraphs packages
- Interactive maps with a few lines of code.
You’ll first need to install two packages, which you can do by running this code in your interactive R console (bottom left pane):
quantmod is a library for financial analysis. dygraphs creates interactive Web graphics of data over time.
A note about installing packages: Usually, this is pretty seamless in R. Occasionally, you might get a message that the package you’re trying to install won’t install, because another package is missing. R should automatically install needed packages by default, but sometimes there’s a glitch. If you get an error message that some other package you didn’t know about is missing, try installing that one manually with
install.packages("missingPackageName") and then run the install on the package you want.
In addition, sometimes you may be asked whether you want to “install from sources the package which needs compilation?” Most of the time, that just means, “Would you like the absolute latest version that doesn’t have a handy, single download file yet?” For all packages we’re using in this book, choosing n for no is easier and should work just fine.
Once installation is done, load both packages into your current R session with
Finally, if you haven’t yet set up an RStudio project for your code related to this book, as I described in the last chapter, create one for this work by going to File > New Project.
Now, let’s give some those packages a try.