I have a list of data frames and I am trying to use lapply
to get rid of anomalies in my data, trying to make the code as robust as possible as the data inputted will be constantly different.
I am trying to use:
newdata <- lapply(ChaseSubSet, function(){
anomalies <- 0.02 > ChaseSubSet[,1] > 0.03
anomalies = na
})
However a) this doesn't work and b) I'm thinking it would be more robust to get rid of values more than 0.1 away from the mean. I would have to apply different rules to each column of the data but have it apply through all the data.frames in the list. I want to use lapply to result in a list at the end.
My data is as follows:
I would like to sort through all 13 dataframes of the list which are all like this image. I would like if there are anomalous values for value to be replaced with NA my thinking is this will create the least issues later on with different columns of different length.
I am still very new so I apologise if any of this is incorrect.