R Programming command to delete a directory – R Tutorials

R Programming command to delete a directory – R Tutorials

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 Programming command

In this R Programming tutorial/post we are discussing the Command to delete a directory in R.


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 delete directory using R Programming command:

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


Step 2: Use the below r programming command to delete the directory.

unlink(“mytestDir“, recursive = TRUE)

**replace the “mytestDir” with your actual directory name.

R Programming uses the word “unlink” instead of “delete” which is more logical for deleting folder because R follows the UNIX way of deleting directory.

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

About Anson

I’m Anson, having versatile experience in Business Process Outsourcing, Finance & Accounting, Information Technology, Operational Excellence & Business Intelligence. I'm currently working in a MNC in Bangalore, India. Learning anything new has always been my passions and if its related to Business and Technology then, I love it. This website/blog is an outcome of my passion towards it and I have been blogging since 2012. Outside business and technology I’m a movie freak who spends hours together watching and learning Cinema.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.