Imagine you want to write the output of an R function into a text file. How would you approach this task?

  • None of the above
  • Use the cat() function with the file argument
  • Use the print() function with the file argument
  • Use the write() function
The cat() function in R can be used to write the output into a file. The file argument should be a character string naming a file. For example, cat("Hello, world!", file = "output.txt") will write the string "Hello, world!" to the file named "output.txt".
Add your answer
Loading...

Leave a comment

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