I have a problem, I want apply a function for several data frame, I call these like follow:
temp = list.files(pattern="*.csv")
for (i in 1:length(temp)) assign(temp[i], read.csv(temp[i], sep = ";"))
after the function called ajuste_tiempos, created by me, like follow:
ajuste_tiempos <- function(datos) {
tiempos <- datos$HOUR
timestamps <- as.POSIXlt(as.POSIXct('1900-1-1', tz='UTC')
+ as.difftime(as.character(tiempos)))
timestamps$min <- (timestamps$min + 5/2) %/% 5 * 5
time <- format(timestamps, format='%H:%M:%S')
date<-paste(datos[,3], time, sep=" ")
date
}
basically it's the function that I want to apply, but after applying this function to the data frames I want to do other manipulations with the columns. I'm trying it this way:
ajuste_tiempos <- list()
ff <- list(temp[i])
a <- lapply(ff, function(i) {ajuste_tiempos(i)})
Does anyone have any idea how I can do it?