Marinstatslectures

Like Us on FacebookFollow Us on TwitterSubscribe to Us on Youtube!Join Us on Google+

Importing Data and Working With Data in R: (R Tutorial 1.4)

 

In this video you will learn how to import a dataset into R, make sure that it is imported properly and begin to work with data.

Here, we will show you how to read a dataset into R using the "read.table" command and save it as an object in R. You will also learn an alternate way of importing data when using RStudio. Later in the video, you will see how you can check to make sure the data was read in properly using R commands such as "dim" to get the number or columns and rows, "head" to see the first 6 rows and "tail" to get the last 6 rows, "names" to check the variable names, and square brackets [] to look at a subset of the data. Here we will show how to use the arguments on the square brackets to get more specific results.

In this tutorial, you will learn to attach data in order to call on the variables by name when performing functions on your data, for example calculating the mean age in the sample. You will also be able to use the "class" command to check the variable type or class, the "as.factor" to convert a numeric variable to a categorical, and "levels" command to ask R for the categories or levels of a categorical variable.

 

We recommend using the link below to download the dataset and practice on your own while watching this tutorial.

 

You can access and download the dataset that was used in this tutorial here: 

Dataset-Icon-Tab2Dataset-Icon-excel3

 

Previous Video in Series 1 R Tutorials Next Video in Series 1 R Tutorials

Back to Series 1 R Tutorials