-2

I want to order de following sequence code

         cereal2[Cereal$Calories & Cereal$Carbs <27.5,]
                                    Name Calories Carbs
                 1            AppleJacks      117    27
                 2             Boo Berry      118    27
                 6           Cocoa Puffs      117    26
                 7          Cookie Crisp      117    26
                 8           Corn Flakes      101    24
                 10              Crispix      113    26
                 12          Froot Loops      118    26
                 17         King Vitaman       80    17
                 18                  Kix       87    20
                 20         Lucky Charms      114    25
                 21 Multi-Grain Cheerios      108    24
                 22           Product 19      100    25
                 25            Rice Chex       94    22
                 28            Special K      117    22
                 30             Wheaties      107    24

How can I sort the calories in ascending order?

Polonio210
  • 67
  • 1
  • 8

1 Answers1

1

A simple one liner in base R :)

df <- df[order(df$Calories),]
thc
  • 9,527
  • 1
  • 24
  • 39