62.1k views
4 votes
___ takes a character vector and writes each element one line at a time to a text file.

A) Cat.
B) Write.
C) Write.table.
D) WriteLines.

1 Answer

0 votes

Final answer:

The function from the options given that writes each element of a character vector to a text file, one line at a time, is WriteLines.

Step-by-step explanation:

The function in question that takes a character vector and writes each element one line at a time to a text file is WriteLines. To clarify, option A (Cat) is used for concatenating and displaying text, but it doesn't necessarily write each element as separate lines in a file. Option B (Write) is too general and not an actual function name. Option C (Write.table) is primarily used for writing data frames to a file, not specifically for writing each element of a character vector line by line. WriteLines will appropriately place each element of a character vector on separate lines in a text file, which is often useful for creating textual data files or logs from within the R programming environment.

User Konstantin Dinev
by
9.0k points