Please don't mind if this question is very basic. I am in the learning process of R.
I have a pooled dataset for summer months for 2000-2010. I want to exclude 9 days below 9 degree celsius from all the data.
Update
I have temperature values in my dataset as;
[1] 9.4 10.2 11.2 12.4 12.6 13.1 13.8 14.3 12.1 10.3 11.0 10.6 9.6 10.5 13.2 14.8
[17] 14.4 15.3 15.9 14.8 14.1 15.0 18.0 19.8 19.9 18.2 16.2 16.2 17.9 19.3 19.4 18.7
[33] 18.5 21.1 23.2 22.7 22.4 22.5 22.6 21.3 19.9 19.5 18.4 17.7 18.3 20.2 21.6 22.0
I want to delete all 9 values previous to 9-degree celsius at each point in my dataset.
I was suggested to use this script:
cleandata<-workdata[-sample(which(workdata$tempd0d1 < 9), 9), ]
I used but it's not working. I am getting same values for tempd0d1 (temperature variable).
cleandata$tempd0d1
1] 9.4 10.2 11.2 12.4 12.6 13.1 13.8 14.3 12.1 10.3 11.0 10.6 9.6 10.5 13.2 14.8
[17] 14.4 15.3 15.9 14.8 14.1 15.0 18.0 19.8 19.9 18.2 16.2 16.2 17.9 19.3 19.4 18.7
[33] 18.5 21.1 23.2 22.7 22.4 22.5 22.6 21.3 19.9 19.5 18.4 17.7 18.3 20.2 21.6 22.0
any quick help would be appreciated.