Skip to main content Skip to navigation
CEREO social science

Bringing in Data and Publicly Available Data Packages

This week we discussed how we bring in data, forms of data, good sources for help, and some packages that pull in publicly available data.

First of all, we talked about R Studio ( R Studio is a great interface for using R and in addition it allows for some “point and click” methods of bring in data. The “input dataset” button on the top right square of the R Studio interface allows you to input data from either a local file on your computer or by connecting to the internet.

Now, data can also be brought in through code. A good resource for ways to import specific types of data is this Quick R page: The most common data type that people work with is .csv files, which are inported using the “read.csv()” command. If you want to read an Excel file you need the “xlsx” package.

If you want to read data from a website, which the point and click method in R Studio lets you do, there are many ways to do it. Two common ways are using the “RCurl” package or the “data.table” package. Examples of that code are below. Remember, to use a package you need to first have the package installed (“buying the book”) and then you need to use the library command to use the package (“taking the book off the shelf”).

myfile <- getURL(‘’, ssl.verifyhost=FALSE, ssl.verifypeer=FALSE)

mydat <- fread(‘’)

Some packages that we discussed which make us of publicly available data are:

Out of these packages EcoRetriever is the hardest to install. You must first install the Retriever program from, then install the ecoretriever package. This will allows you program in queries of the data available at

An example of using one of these packages, the dataRetreival package which is automatically accessed through the package ‘EGRET’ can be found here: r_for_hydrology_script.  This script is from R Working Group contributor Tung Nguyen.

In addition to those packages there were questions about Economic and Social Science data sources. Here are some packages or resources that I tracked down which have data specific for those fields: