r - Sorting a column into category -


I have a table with the names and height of two columns. I want to classify those who are above 6 feet below 4 feet and are classified as tall, small and average respectively between 4 to 6 feet.

I am trying to do this in R-Studio. One way to classify them in a different column is also fine.

  ** name height ** james 5.6 john 3.7 ron 6.8 to 5.2    <("James", "John", "Ron", 

Your data:

  name & lt; -c "to") height & lt; -c (5.6,3.7,6.8,5.2) dat & lt; -data.frame (name, height)   

You can do this by adding and adding a new variable according to your criteria: $$ Group $ lt; - "average" data $ group [$ $ height = 4] & lt; - "Brief" $ $ [$ $ height = 6] & lt; - "Long" # Name Height Group # 1 James 5.6 Average # 2 John 3.7 Small # 3 Ron 6.8 Long # 4 To 5.2 Average

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -