R Error in file(file, “rt”) : invalid ‘description’ argument (read.table & csv)
This post illustrates how to deal with the “Error in file(file, “rt”) : invalid ‘description’ argument” in R programming.
The article contains this information:
It’s time to dive into the tutorial…
Example 1: Reproduce the Error in file(file, “rt”) : invalid ‘description’ argument
The following syntax shows how to reproduce the “Error in file(file, “rt”) : invalid ‘description’ argument” in R.
Let’s assume that we want to import a CSV file from our computer to R. Then we might try to use the following R syntax:
read.csv2(paste0(1:2, ".csv")) # Trying to insert multiple file names # Error in file(file, "rt") : invalid 'description' argument
Unfortunately, the previous R code returns the “Error in file(file, “rt”) : invalid ‘description’ argument” to the RStudio console.
The reason for this is that we have tried to insert multiple file names or paths at the same time (i.e. by using 1:2 within the paste0 function).
The read.csv (or read.table) function does only take one file path at the same time as input.
So how can we solve this problem? That’s what I’m going to show you next.
Example 2: Reproduce the Error in file(file, “rt”) : invalid ‘description’ argument
The following R programming code illustrates how to fix the “Error in file(file, “rt”) : invalid ‘description’ argument”.
For this, we simply have to insert only a single file path to the read.csv function:
read.csv2(paste0("only_one_name", ".csv")) # Using only one file name
The previous R code works fine.
Video & Further Resources
Have a look at the following video of my YouTube channel. In the video, I’m showing the R programming codes of the present page:
The YouTube video will be added soon.
Furthermore, you could have a look at some of the related articles on this homepage. I have released several posts about error messages in R already:
- How to Fix in R: Error in file(file, “rt”) : cannot open the connection
- Handling Warning & Error Messages in R
- Introduction to R
In this tutorial you have learned how to debug the “Error in file(file, “rt”) : invalid ‘description’ argument” in the R programming language. Let me know in the comments, if you have additional questions. Besides that, don’t forget to subscribe to my email newsletter in order to get regular updates on the newest articles.
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.
Thank you!
Welcome to the Statistics Globe newsletter. From now on, I’ll send you regular emails about statistics, data science, AI, and programming with R and Python.
I’m Joachim Schork. On this website, I provide statistics tutorials as well as code in Python and R programming.
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.
Thank you!
Please check your email inbox and click the confirmation link to complete your subscription. If you don’t see the email within a few minutes, please also check your spam/junk folder.






