The file.create()
function in R creates a file from the console, with the file name passed as the argument.
file.create(...)
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.
The file.create()
function returns a Boolean value, TRUE
or FALSE
, to indicate if the file is created or not.
# Creating a filefile.create("ABC.txt")
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.