R Command to check if a file exists in the directory

R Programming
Table of Contents

R Command to check if a file exists in the directory

What is it:

R is a free software programming language used in the field of statistical computing and graphics. This program is mainly used by Statisticians and Data Analysts.R CommandPin

In this r programming tutorial/post we are discussing R Command to check if an R file exists in the directory.

Why:

Though Operating systems will have simpler way of doing this however when you are working in the programming environment having the ability to use the commands for creating or manipulating the files is always useful.

How to check if a file exists in the directory using R Command:





Step 1: If you do not know your active directory check the same using the below command.

getwd()

Step 2: Use the below r command to check if the file exists in your current directory

file.exists(“myFile.R“)

**replace the “myFile” with your actual file name.

Note: Make sure you are using the commands after the ‘>’ symbol


Picture of Anson Antony
Anson Antony
Anson is a contributing author and the founder of www.askeygeek.com. His passion for learning new things led to the creation of askeygeek.com, which focuses on technology and business. With over a decade of experience in Business Process Outsourcing, Finance & Accounting, Information Technology, Operational Excellence & Business Intelligence, Anson has worked for companies such as Genpact, Hewlett Packard, M*Modal, and Capgemini in various roles. Apart from his professional pursuits, he is a movie enthusiast who enjoys spending hours watching and studying cinema, and he is also a filmmaker.

One Response

Leave a Reply

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

Congratulations!
You Made It,
Don't Close!

UberCreate Creator Pro Access
for Free!!!

This popup won’t show up to you again!!!

Share to...