I need to add a function to deal with the NA values, but I am comparing one temperature to another to see the difference between them and I don’t know how best to deal with the NAs. I would like for the program to ignore the NAs, and just compare the temperature to the next available one.
Here is the code I am using (this is part of a large four loop with additional fucntions)
for(i in 2:nrow(cow_1)) {
if(abs(cow_1$temperature..C[i] - cow_1$temperature..C[i-1]) > 1) {
meanval=avg6(cow_1$temperature..C,i)
cow_1$temperature..C = next12(cow_1$temperature..C,i,meanval)
}
}
New contributor
Pippa Pryor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.