Re: [R] Binning or grouping data

2009-06-04 Thread Glen Sargeant
alamoboy wrote: > > Newbie here. Many apologies in advance for using the incorrect lingo. > I'm new to statistics and VERY new to R. > > I'm attempting to "group" or "bin" data together in order to analyze them > as a combined group rather than as discrete set. I'll provide a simple > examp

Re: [R] Binning or grouping data

2009-06-04 Thread Glen Sargeant
alamoboy wrote: > > Newbie here. Many apologies in advance for using the incorrect lingo. > I'm new to statistics and VERY new to R. > > I'm attempting to "group" or "bin" data together in order to analyze them > as a combined group rather than as discrete set. I'll provide a simple > examp

Re: [R] Binning or grouping data

2009-06-04 Thread Ronggui Huang
Personally, I prefer the recode() in package of car. Ronggui 2009/6/4 Philipp Pagel : >> I'm attempting to "group" or "bin" data together in order to analyze them as >> a combined group rather than as discrete set.  I'll provide a simple example >> of the data for illustrative purposes. >> >> Pat

Re: [R] Binning or grouping data

2009-06-04 Thread Allan Engelhardt
You want cut and tapply, perhaps along these lines: ## Your data frame: a <- data.frame(patient=1:6, charges=c(100,500,200,90,400,500), age=c(0,3,5,7,10,16), race=c("black","white","hispanic","asian","hispanic","black")) ## Add an age category: a <- cbind(a, age_category=cut(a$age, breaks=c(-

Re: [R] Binning or grouping data

2009-06-04 Thread Philipp Pagel
> I'm attempting to "group" or "bin" data together in order to analyze them as > a combined group rather than as discrete set. I'll provide a simple example > of the data for illustrative purposes. > > Patient ID | Charges |Age | Race > 1 | 100 |0 | Bla

[R] Binning or grouping data

2009-06-04 Thread alamoboy
Newbie here. Many apologies in advance for using the incorrect lingo. I'm new to statistics and VERY new to R. I'm attempting to "group" or "bin" data together in order to analyze them as a combined group rather than as discrete set. I'll provide a simple example of the data for illustrative p