Grouping data into ranges in R
Posted
by
Maddy
on Stack Overflow
See other posts from Stack Overflow
or by Maddy
Published on 2012-09-07T09:28:49Z
Indexed on
2012/09/07
9:38 UTC
Read the original article
Hit count: 206
supposing i have a data frame in R that has names of students in one column and their marks in another column. these marks range from 20 to 100.
> mydata
id name marks gender
1 a1 56 female
2 a2 37 male
i want to divide the student into groups, based on the criteria of obtained marks, so that difference between marks in each group should be more than 10. i tried to use the function table, which gives the number of students in each range from say 20-30, 30-40, but i want it to pick those students that have marks in a given range and put all their information together in a group. any help is appreciated.
© Stack Overflow or respective owner