R – How to open a file

R you going to open up a file pretty sharply!

In R studio have you been searching high and low on how to open a file?! Well, search no more as we have a video that will answer your questions.

Today we are going to cover off the following ways in which you can access files:

  • read.table
  • read_excel
  • read.csv
  • readLines

Whether you have a txt, CSV or XLSX file, this video will help you get to your information so that you can complete data analysis.

What can those functions do for you, let’s delve a bit further?

From the documentation found here R Documentation – read table, you will be able to see that this function creates a dataframe based on the file you have opened. It also allows you to test the feature.

If R Documentation – read excel is your thing then you will see here that it does what it says on the tin, and also has some additional validations available if you need them.

If you are looking for an almost identical function to read.table, then read.csv is the one except for defaults. Additional information can be found here at R Documentation – more on read.csv

Last but not least, R Documentation – readLines is a useful way to open a file and can be used to read some or all of a text within a file.

Wrapping it up

This blog post has described some excellent choice in how to open a file, and indeed, the documentation above will help explain it further. There is a Python equivalent of this, and you can source it at the following link Python – How to import data from files

Data Analytics Ireland

 

Leave a Reply

Your email address will not be published. Required fields are marked *