-4

My assignment is sorting "Petal.Length" in iris dataset (which is offered by R)

'L' (less than 1.6)

'M' (between L and H)

'H" (more than 5.1)

and print out? display? the outcome

sorry for my broken english

Thank you in advance

Phil
  • 7,287
  • 3
  • 36
  • 66
KIM
  • 1

1 Answers1

0

with subset you can filter the dataframe based on each of your 3 conditions. Then, rbind those together:

rbind(
  subset(iris, Petal.Length < 1.6),
  subset(iris, Petal.Length>=1.6 & Petal.Length<=5.1),
  subset(iris, Petal.Length > 5.1)
)
NicolasH2
  • 774
  • 5
  • 20