Accessing & Importing Data


Image result for R programing logo

R  can read the data outside of its environment and also write the data into files which will be stored and accessed by the operating system. There are various types of data formats that R can read, such as; csv, excel, xml, binary, web data, etc.  Commonly,  people store the data in excel spreadsheets and  R is able to access the excel spreadsheets with different packages. Also, users can save the excel spreadsheets as a CSV files to be used in R build-in functions.  In this post,  let’s understand how to read and write the data into CSV (Comma Separated Values) file.

CSV file is a text file and the values in the file are separated with commas.  The file extension is *.csv.  You can use a text editor to create a new or save the existing text or excel file as CSV file by just having the correct extension.  

You need to have a CSV file in your working directory (either it could be an existing R directory or you can set your own one) so that R is able to read it. 

The following graph highlights different steps in CSV file utilization.

The following table shows the functions that could be used in each step.

Let’s see some examples;

I hope you are able to follow up with the examples that I put together.  In the next post,  I will share one of the projects that I did for a statistical analysis of past NBA (National Basketball Association) MVPs (Most Valuable Players).

Leave a comment