[R] Using multiple dat files
Sibylle Stöckli
@|by||e@@toeck|| @end|ng |rom gmx@ch
Wed Nov 6 07:29:27 CET 2024
Dear community
To import multiple .dat weather files I am using list.files().
I intend to use the R package “ClimInd” to calculate different agroclimatic indicators.
Question: Is there another solution to import multiple .dat files so that I can select elements from the list, e.g. one specific weather file (example AAR_DailyWeather)?
# Import multiple .dat files weather data
filelist <- list.files(path = "O:/Data-Work/……./Daten_RA-MeteoCH_1990-2021", pattern='*.dat', all.files= T, full.names= T)
W <- lapply(filelist, function(x) read.table(x, header = TRUE, sep = "", colClasses = "numeric", comment.char = ""))
W[[1]]
> dd(data = W[[1]]$Precip, time.scale = W[[1]]$year)
Fehler in W[[1]]$year : $ operator is invalid for atomic vectors
Kind regards
Sibylle
More information about the R-help
mailing list