Skip to content
  • YouTube
  • FaceBook
  • Twitter
  • Instagram

Data Analytics Ireland

Data Analytics and Video Tutorials

  • Home
  • Contact
  • About Us
    • Latest
    • Write for us
    • Learn more information about our website
  • Useful Links
  • Glossary
  • All Categories
  • Faq
  • Livestream
  • Toggle search form
  • TypeError: List Indices Must Be Integers Or Slices, Not Tuple exceptions
  • What does a data analyst do? Livestream
  • Python Dictionary Interview Questions Python
  • R – How to open a file R Programming
  • How to create a class in Python class
  • How to count the no of rows and columns in a CSV file CSV
  • How can I filter my data in Tableau? data visualisation
  • How to Pass a Javascript Variable to Python using JSON Flask

R – How to check a file exists and is not empty

Posted on May 20, 2020December 29, 2020 By admin No Comments on R – How to check a file exists and is not empty

Here is another way to check if a file is empty, this time in R!
In the recent past, we posted about How to check if a file is empty in Python, this post looks to build on that and show you in R Programming how to get the same effect.

When looking at the two programming languages, that while the concepts are pretty much the same, the syntax used to achieve the outcome can be slightly different; hence you have to remember which language you are in when writing the code!

Ensure the files exists and open it, gotta be confident it there 🙂

As a preliminary step we check to see if the file exists using:

if(file.exists("emptyfilea.txt")
... rest of your code

 

Then we go and see if the file is empty or not. The full code can be viewed here.

Additional information to help you along the way.

I have referenced this site before, it has some very useful explanations of different functions and methods, for files Check R Documentation

Data Analytics Ireland

 

R Programming Tags:Check for empty file, Data, Data Analysis, Data Analytics, R programming language, Working with files

Post navigation

Previous Post: R – How to open a file
Next Post: R tutorial – How to sort lists using rstudio

Related Posts

  • R Tutorial: How to pass data between functions R Programming
  • What is the r programming language R Programming
  • R tutorial – How to sort lists using rstudio R Programming
  • how to remove unwanted characters from your data R Programming
  • R – How to open a file R Programming

Leave a Reply Cancel reply

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

Select your language!

  • हिंदी
  • Español
  • Português
  • Français
  • Italiano
  • Tkinter GUI tutorial python – how to clean excel data Python
  • R – How to open a file R Programming
  • How To Pass Data Between Functions Python Functions
  • IndexError: index 2 is out of bounds for axis 0 with size 2 Index Error
  • How to use wildcards in SQL SQL
  • how to create and drop a table in SQL SQL
  • How to import data into excel Python Tutorial
  • How to Pass Python Variables to Javascript Javascript

Copyright © 2023 Data Analytics Ireland.

Powered by PressBook Premium theme

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT