R – How to open a file

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 data frame 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


Python Tutorial: How to import data from files

Estimated reading time: 1 minute

Is there a need for you to be quickly open files, and import the data into a data frame?

In this post and video on Python, we will look at several options for you to do this as well as some additional things to consider.

The import of files covered here is as follows:

  • Reading data from a CSV file.
  • Reading data from a TXT file.
  • Reading data from an XLSX file.

On importation there are many things to consider, here are a few to consider:

(A) The file format

(B) How the data looks within the file.

(C) Special requirements to get the data looking correct when loaded.

In this file importing example dealing with tab delimiters, headers and sorting are referenced.  Here are some different ways to approach it a little differently if you are looking for alternatives CSV File Reading and Writing

Thanks for watching, please follow us by clicking on the links to the right!

Need to check if a file is empty? Have a look here Python – How to check if a file is empty


Data Analytics Ireland