Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

how to read in a text file in r

# Read tabular data into R
read.table(file, header = FALSE, sep = "", dec = ".")
# Read "comma separated value" files (".csv")
read.csv(file, header = TRUE, sep = ",", dec = ".", ...)
# Or use read.csv2: variant used in countries that 
# use a comma as decimal point and a semicolon as field separator.
read.csv2(file, header = TRUE, sep = ";", dec = ",", ...)
# Read TAB delimited files
read.delim(file, header = TRUE, sep = "	", dec = ".", ...)
read.delim2(file, header = TRUE, sep = "	", dec = ",", ...)
 
PREVIOUS NEXT
Tagged: #read #text #file
ADD COMMENT
Topic
Name
6+2 =