Skip to Main Content

R

Ways to View Data in RStudio

Data in RStudio can be viewed in the a data tab or as output in the console. The data tab has the name of the dataset on the very top left corner to let you know what dataset you are working with, if there are multiple open.

To view data in RStudio you may click on the data in the environment that is highlighted in red below. This will open a tab for browsing through data.

 

There are multiple options to view data in RStudio. You may open a designated data tab to view the data or call on RStudio to show it in the output tab. 

Below is the code for viewing an entire dataset in the RStudio output.

Code

SLID 

 

We are simply stating to the name of the dataset to view it in the output. 

Output

The output for the code above is the observations listed in rows and variables as columns. RStudio will provide all the variables and observations in the dataset.

 

 

Note: a " NA " in RStudio indicates a missing datum point. 

We can also specify to see just the first six cases of the dataset with the code below.

 

head(SLID)

 

We are printing the head of the dataset SLID

OUTPUT

 wages education age    sex language
1 10.56      15.0  40   Male  English
2 11.00      13.2  19   Male  English
3    NA      16.0  49   Male    Other
4 17.76      14.0  46   Male    Other
5    NA       8.0  71   Male  English
6 14.00      16.0  50 Female  English

In RStudio we can learn more about how each variable is coded, the labels, and the format of the variable. Below is the code for finding information for all variables in the dataset at once

Code

help(SLID)

 

We are getting help to learn more about the SLID dataset.

Output

undefined