Complete the code to read a file named 'data.txt' using read.table with default delimiter.
data <- read.table('data.txt', sep=[1])
The default delimiter for read.table is a space, so sep=" " is correct.
Complete the code to read a CSV file named 'data.csv' using read.table with the correct delimiter.
data <- read.table('data.csv', sep=[1], header=TRUE)
CSV files use commas to separate values, so sep="," is correct.
Fix the error in the code to read a semicolon-delimited file named 'data.txt'.
data <- read.table('data.txt', sep=[1], header=TRUE)
Semicolon-delimited files require sep=";" to separate columns correctly.
Fill both blanks to read a tab-delimited file 'data.tsv' with headers.
data <- read.table('data.tsv', sep=[1], header=[2])
Tab-delimited files use sep="\t" and header=TRUE if the file has column names.
Fill all three blanks to read a file 'data.txt' with pipe '|' delimiter and no headers.
data <- read.table('data.txt', sep=[1], header=[2], stringsAsFactors=[3])
Pipe-delimited files use sep="|". If no headers, header=FALSE. stringsAsFactors=FALSE prevents automatic factor conversion.