What is the file.create() function in R?

Overview

The file.create() function in R creates a file from the console, with the file name passed as the argument.

Syntax

file.create(...)
Syntax for the file.create() function

Parameter

The file.create() function takes the parameter ..., which represents character vectors containing file names or paths. In other words, it represents the name of the file to be created.

Return value

The file.create() function returns a Boolean value, TRUE or FALSE, to indicate if the file is created or not.

Example

# Creating a file
file.create("ABC.txt")

Explanation

In the code above, we create a file named "ABC.txt" using the file.create() function. The code outputs TRUE, which means that the file has been created successfully. If the file already existed, the output would be FALSE, and R would display a warning message.

Free Resources