Read, Write Data

Read table - Single File
data = read.table(file = "datafile.dat", header = TRUE)

Read Table - Multiple Files
files = list.files(pattern="00007.*day", recursive = TRUE) files = list.files(pattern="Root") file1 = read.table(files[1],header = TRUE)
 * 1) Multiple conditions, all folders
 * 1) Single condition
 * 1) Read single file

Read Table - Multiple Files to one List
files = list.files(pattern="Daily") Files = lapply(files, read.table, header = TRUE)

Read Table - Multiple Files in seperated Dataframes
temp = list.files(pattern="*.dat") for (i in 1:length(temp)) assign(temp[i], read.table(temp[i], header = TRUE, sep = ";"))
 * 1) Assign filename automatically

Read CSV
temp = list.files(pattern="*.csv") for (i in 1:length(temp)) assign(temp[i], read.csv(temp[i], header = TRUE, sep = ";"))

Write Table
file_name <- paste ("data.dat", col="", sep="") write.table(Data, file_name, row.names=TRUE, col.names=TRUE) AnzahlJahre = "10" AbDatum = "2000" EndDatum = "2009" file_name <- paste ("EUmax_",AnzahlJahre,"J_",AbDatum,"_",EndDatum,".dat", col="", sep="") write.table(Data, file_name, row.names=TRUE, col.names=TRUE)