How to remove a directory in R? Last Updated : 14 Sep, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will discuss how to remove a directory using R programming language. To remove a directory in R we use unlink(). This function deletes the named directory. Syntax: unlink(directory-name, recursive = BOOLEAN) Parameter: directory-name: a character vector with the names of the directories to be deleted.recursive: BOOLEAN TRUE/FALSE, if true directory is deleted recursively otherwise only empty directories are deleted. Return: It returns normally 0 for success, 1 for failure. Not deleting a non-existent file is not a failure so in that case return 0. Note: File naming conventions depend on the platform. Directory in use: Directory used Example: Removing directory using R programming language R # list files or directories in working directory list.files(path=".", pattern=NULL, all.files=FALSE, full.names=FALSE) # delete the directory demo in working directory unlink("Demo",recursive=TRUE) # list files or directories in working directory # after deletion list.files(path=".", pattern=NULL, all.files=FALSE, full.names=FALSE) Output: Console Output Final Directory after running the above code: Final state of Directory Comment More infoAdvertise with us Next Article How to Remove Directory From a Git Repository? M mishrapriyank17 Follow Improve Article Tags : R Language R directory-programs Similar Reads How to Remove Directory in Linux In Linux, directories are used to organize files and other directories into a hierarchical structure. Just like folders in Windows, directories in Linux can contain files, other directories, and links. Removing directories in Linux is a common task that you might need to perform as you manage files 5 min read How To Remove A Column In R R is a versatile language that is widely used in data analysis and statistical computing. A common task when working with data is removing one or more columns from a data frame. This guide will show you various methods to remove columns in R Programming Language using different approaches and provid 4 min read How to Remove Directory From a Git Repository? Managing files and directories within a Git repository is a common task, especially when you need to clean up or reorganize your project's structure. Removing a directory from a Git repository involves several steps to ensure that the change is tracked and applied correctly. In this article, we will 2 min read How to Manage Directories in Linux? Directories in Linux or any operating system help to organize the data and files, which is then easier to find and manage. In this article, you will learn everything you will need to manage directories in Linux. We will try to cover every topic from creating, and copying to deleting the directories 6 min read How To Remove Row In R In R Programming Language you can remove rows from a data frame using various methods depending on your specific requirements. Here are a few common approaches: Remove Row Using Logical IndexingYou can remove rows based on a logical condition using indexing. For example, to remove rows where a certa 3 min read How to Rename a Folder in Linux Renaming a folder in Linux is possible with Graphical User Interface (GUI) file managers as well as with powerful command-line utilities such as mv, rename, find, and rsync. Be it a novice utilizing Ubuntu, Debian, CentOS, Fedora, or Kali Linux or an expert dealing with bulk renaming in the terminal 12 min read Like