List of Dataframes

Read Data to List of Dataframes
files = list.files(pattern="*00007.*day", recursive = TRUE, header = TRUE) Data = lapply(files, read.table)

Rename DF in list of dataframes
names(Stats) = df_names

Transform List of Dataframes to Single Dataframe
Data = data.frame(Reduce(rbind, datalist))

Create single Dataframe out of List of Dataframes
library(tidyverse) Stats = Stats %>% reduce(left_join, by = "Day")

Transform column to Date in List of Dataframes for(i in 1:length(data)){ datai[,1] = as.Date(datai[,1],format="%Y-%m-%d")} class(data2[,1])

Extract certain Periode of Time in List of Dataframes StartDate= "2000-01-01" EndDate = "2009-12-31"

for(i in 1:length(data)){ datai = datai[(datai"V1") >= StartDate, ] datai = datai[(datai"V1") <= EndDate, ]}

Linear Regression within a List of Dataframes
Temp_subs <- Map(function(nm) Temp[c("Year", "Day", nm)], names(Temp)[-(1:2)]) library(reshape) Temp_subs = lapply(Temp_subs, function(x) {  cast(x, Year ~ Day)}) Statframe = data.frame(Day=1, Konstante=1, Trendwert=1, Pvalue=1)[-1,] for (a in names(Temp_subs)) { for(i in 2:ncol(Temp_subs1)) { #Regression-Model x <- Temp_subs1$Year y <- Temp_subsa[,i] mod <- lm(y ~ x)    summary(mod) #Add Statistics to empty DF    #Overview str(summary(mod)) Statframe[i,] <- c(i,                       summary(mod)'coefficients'['(Intercept)','Estimate'],                        summary(mod)'coefficients'['x','Estimate'],                        summary(mod)'coefficients'['x','Pr(>|t|)']) filename <- paste(a, "_Statistics.txt", col="", sep="") write.table(Statframe, filename, row.names=TRUE, col.names=TRUE) } }
 * 1) Create Subsets
 * 1) Transform Df-list
 * 1) Empty DF for Regression
 * 1) Loop for output

Regression Part II
library(lubridate) date_list = seq(ymd('2019-05-01'),ymd('2019-09-30'),by='day') date_list = date_list[which(month(date_list) %in% c(5:9))] for (a in 1: length(Stats)) { Statsa$Day = date_list } for (a in 1: length(Stats)) { rownames(Statsa) = NULL } for (a in 1: length(Stats)) { Statsa$Start = 2005 } for (a in 1: length(Stats)) { Statsa$Ende = 2016 } for (a in 1: length(Stats)) { Statsa$Tline_Start = Statsa$Trendwert * Statsa$Start + Statsa$Konstante } for (a in 1: length(Stats)) { Statsa$Tline_Ende = Statsa$Trendwert * Statsa$Ende + Statsa$Konstante } for (a in 1: length(Stats)) { Statsa$Veränderung_C = Statsa$Tline_Ende - Statsa$Tline_Start } for (a in 1: length(Stats)) { Statsa$Veränderung_P = Statsa$Tline_Ende / (Statsa$Tline_Start / 100) - 100 } sapply(names(Stats),       function (x) write.table(Statsx, file = paste(x, "_ALLStatistics.txt"), row.names=TRUE, col.names=TRUE))
 * 1) replace Date
 * 1) Reset rownumber
 * 1) Add Start and End-Date
 * 1) Trends for beginning and end of periode
 * 1) Changes
 * 1) Changes in %
 * 1) Output in single files

Update Column-Names
for(i in 1: length(Stats)){ allcolnames = colnames(Statsi) allcolnames = paste(allcolnames, names(Stats)[i], sep = "_") colnames(Statsi) = allcolnames } Stats <- lapply(Stats, function(x) {colnames(x)[1] <- "Day"; x})
 * 1) Update only first column

Extract certain columns
colextract = c(1,3) Stats = lapply(Stats, "[",, colextract)

Create list of multiple random dataframes
for (a in 1:32) { nam <- paste("date_list", a, sep = "") assign(nam, data.frame(Date = sample(seq(ymd('2000-01-01'),ymd('2000-12-31'),by='day'),10))) } splitlist <- mget(ls(pattern="date_list"))