0

I was referred to stackoverflow from codereview.stackexchange (https://codereview.stackexchange.com/questions/138189/cant-see-my-error-in-r-code-to-restrict-prune-trim-dataset?noredirect=1#comment258197_138189) for this question.

For the past 30 mins I've been staring at this line of code trying to figure out why I can't restrict a data frame within desired boundaries.

So I have this dataframe with 6 columns:

> Finke_MXW[100,]
    MHW_diff GHGFINKE2 GHGECO MLW_diff GLGFINKE2 GLGECO
100     -112        13    125      -53       164    217
> 

And I want to limit the dataframe to a certain range for the values of one column MHW_diff, but the length of the data frame columns remains unchanged.

> Finke_MXW_minFx<-Finke_MXW[Finke_MXW$MHW_diff > -254 | Finke_MXW$MHW_diff < 257,]
> summary(MHW_diff)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-894.000  -35.000    2.000   -2.212   38.000  446.000 
> length(Finke_MXW$MHW_diff)
[1] 1686
> length(Finke_MXW_minFx$MHW_diff)
[1] 1686

Any ideas? It's probably something small. :/

Community
  • 1
  • 1

0 Answers0