Instructions for creating a new dataset in RStudio

Step 1: Create a dataset in Microsoft Excel

One of the most convenient aspects of RStudio is its capacity to read Microsoft Excel files very easily. Thus, the first step is to create a new dataset in Excel.

For this example, we use the following research question: How do regime type and population size influence economic performance in Sub-Saharan Africa? Data for these variables were taken from Freedom House (freedomhouse.org) and the World Bank (data.worldbank.org). Regime type is measured by Freedom House on a scale from 0 to 100, with 0 representing no democracy and 100 representing full democracy. Population size is taken from the World Bank (in real numbers).  Economic performance, measured as GDP per capita per annum, is also taken from the World Bank.

In Microsoft Excel, use the top line for the variable names and then enter the data for each observation, as seen below. Be sure to enter the data carefully to ensure you don’t make any mistakes. In this example, you can see that only three countries have been added. Your dataset will clearly have more observations, depending on your research population.

Step 2: Open RStudio and the Excel file

To open this Excel file in RStudio, you first need to open RStudio.

Click on “Import Dataset” on the top right (Under Environment, History, and Connections), and choose “From Excel.”

This will open the Import Excel Data screen

From here, click Browse on the top right of the screen. Find the Excel file with your data on your computer, select it, and then click Import on the bottom right of the screen. You will see that your Excel file is now open in RStudio, with the variable names at the top.

Once these steps are complete (and your Excel file is now open in RStudio), you can perform quantitative analysis exactly as you did with the data from the Dataprac. First perform descriptive statistics on your variables, and then conduct bivariate and multivariate data analysis.

Back to top