Sys.chmod Function in R (Example)


This tutorial explains how to change file permissions using the Sys.chmod function in R.

The article contains this content:

Let’s take a look at some R codes in action.


Example: Manage File Permissions Using Sys.chmod() Function

In this example, I’ll show how to specify the permission for a file on your computer using the Sys.chmod command.

Within the Sys.chmod function, we have to set the working directory path where the file is located, and we have to define the mode of permission for this file.

Have a look at the following R code:

Sys.chmod("C:/Users/Joach/Desktop/my directory/my file.txt",  # Apply Sys.chmod function
          mode = "0777")

The previous R syntax has set the file permission for a TXT called “my file.txt”. We can change the permissions for this file by switching the mode. Learn more about different permission modes here.


Video & Further Resources

Would you like to know more about the application of the Sys.chmod function? Then I recommend watching the following video on my YouTube channel. In the video, I’m explaining the R code of this tutorial:


The YouTube video will be added soon.


In addition, you could read some of the related tutorials on


Summary: On this page you have learned how to apply the Sys.chmod function to perform a manipulation of file permissions in R. Let me know in the comments section, if you have any additional questions.


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.