How to check the file type in R language?

In R language, you can use the following code to check the type of a file:

file <- "path_to_your_file"
file_info <- file.info(file)
file_type <- file_info$type
print(file_type)

In this case, path_to_your_file is the path of the file you want to view. Running the above code will output the type of the file, common types include file (ordinary file), directory (folder), and so on.

bannerAds