Possible Duplicate:
Create categorical variable in R based on range
Given a range and number of intervals that are desired how do i create equal intervals in R
. eg. If the range is between 1 and 100 and i want to create 10 intervals, I should get 1 - 10, 11 - 20, ..., 91 - 100. Only this function should work for any range and any number of intervals. If i have a range of 0 to 1 and number of intervals 30, then it should create the ranges such as 0 - 0.03, ..., 0.97 - 1, and so on. The aim is to use these ranges to obtain values from a data.frame.
If you have
minVal<-0
maxVal<-1
numItv<-30
you can use
seq(minVal, maxVal, length.out=numItv+1)
to get the cutpoints for your intervals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With