I have a data frame x with columns a,b,c.
I am trying to order the data based on columns a and c and my ordering criteria is ascending on a and descending on c. Below is the code I wrote.
z <- x[order(x$a,-x$c),]
This code gives me a warning as below.
Warning message:
In Ops.factor(x$c) : - not meaningful for factors
Also, when I check the data frame z using head(z), it gives me wrong data as below:
30708908 0.3918980 NA
22061768 0.4022183 NA
21430343 0.4118651 NA
21429828 0.4134888 NA
21425966 0.4159323 NA
22057521 0.4173094 NA
and initially there wasnt any NA values of the column c in the data frame x. I have gone through a lot of threads but couldn't find any solution. Can anybody please suggest.