Remove NA when using "order"

I have this huge data matrix with columns for the year, month, day and rainfall that I need to order, and also delete the row when the rainfall is NA (which happens on day 31 of every month that has only 30 days and Februaries. ..). After consulting with r help files, I used the following code:

dat<- aa[order(aa$year, aa$month, aa$day, na.last=NA),] 

He arranged my data perfectly, but I still have NA. Can someone tell me why it is not working?

thank

> head(dat)
    code year month                  station ALTITUD   PROV LONGITUD LATITUD day P1 id
1.1 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   1  0  1
1.2 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   2  0  1
1.3 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   3  0  1
1.4 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   4  0  1
1.5 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   5  0  1
1.6 3059 1940    11 ALBALATE DE LAS NOGUERAS     855 CUENCA   216372  402200   6  0  1
+5
source share
2 answers

na.last order NA , order .... NA aa$precipitation, aa$year, aa$month aa$day, :

dat <- na.omit(aa[order(aa$year, aa$month, aa$day),])

, zoo xts, .

+6

na.last , NA NA. na.omit(dat) NA.

, .

+3

All Articles