There are lots of good reasons you might want to analyze public data, from detecting salary trends in government data to uncovering insights about a potential investment (or your favorite sports team).

But before you can run analyses and visualize trends, you need to have the data. The packages listed below make it easy to find economic, sports, weather, political and other publicly available data and import it directly into R -- in a format that's ready for you to work your analytics magic.

[ Learn more about R with our Advanced Beginner's Guide to R ]

Packages that are on CRAN can be installed on your system by using the R command install.packages("packageName") -- you only need to run this once. GitHub packages are best installed with the devtools package -- install that once with install.packages("devtools") and then use that to install packages from GitHub using the format devtools::install_github("repositoryName/packageName") . Once installed, you can load a package into your working session once each session using the format library("packageName") .

Some of the sample code below comes from package documentation or blog posts by package authors. For more information about a package, you can run help(package="packageName") in R to get info on functions included in the package and, if available, links to package vignettes (R-speak for additional documentation). To see sample code for a particular function, try example(topic="functionName", package="packageName") or simply ?functionName for all available help about a function including any sample code (not all documentation includes samples).

For more on best R packages, see Great R Packages for data import, wrangling and visualization.