I want to apply the same function to a list of dataframes and create a new list with new dataframes. Actually, I am very close to the solution to the problem but I stopped and I could not find the solution online.
O_peaks = lapply(O, function(x){
get_peaks(O[[x]][[1]], O[[x]][[2]],
ignore_threshold = 0, span = 71, strict = TRUE, x_unit = "", x_digits = 3)
})
I think I misused the [[x]]. I tested a similar code:
O_peaks = lapply(O, function(x){
get_peaks(O[[1]][[1]], O[[1]][[2]],
ignore_threshold = 0, span = 71, strict = TRUE, x_unit = "", x_digits = 3)
})
In this case, I obtain a new list with the same number of dataframes of O, but since I wrote O[[1]][[1]], O[[1]][[2]]
the new dataframes contain just the information from the first dataframe in O.
Are there any suggestions about how to apply the same function to all my dataframes?
Thank you in advance.