Sunday, December 22, 2013

2.3 Importing and making a matrix of a dataset

Importing and making a matrix of the dataset


Reviewing the previous steps

In the previous steps of this tutorial you learned how to set the working directory, how to convert to a .csv-file and how to check your dataset. By executing these steps you are ready to import the dataset into the R console.

Figure 17: Making a matrix of the imported dataset
Figure 17: Making a matrix of the imported dataset

Importing the dataset

In the example of Figure 17 the dataset Projects.csv is imported. This is executed by the code read.csv('Projects.csv').

Making a variable of the dataset

Making a importing and making a variable of the dataset could also be done by one command, in case of calling the variable of the dataset Projects use the following command: Projects<-read.csv('Projects.csv'). The dataset is now attached to the variable called Projects

Making a matrix of the dataset

To make a matrix of the dataset, use the command attach(*name of the variable*)
In the example of Figure 17 a matrix is created for the variable Projects with the code attach(Projects). To give an overview of the matrix of the dataset you can make R present a summary by using the command summary(*name of the variable*). In the example a summary is presented of the dataset Projects.csv. with the variable Projects by using the command summary(Projects).

To the next step: Modifying data in R

No comments:

Post a Comment