Try see doBy package.

Below you have a code on brute force.

kind regards,

miltinho
brazil----

===
number.of.records<-20
my.df<-data.frame(v1=sample(21:34,number.of.records, replace=T),
v2=runif(number.of.records), v3=runif(number.of.records))
my.df$v1<-as.numeric(as.character(my.df$v1))
my.df$v2<-as.numeric(as.character(my.df$v2))
my.df$v3<-as.numeric(as.character(my.df$v3))

my.df

## up to here we just created a data.set

my.df$v1.class<-cut(my.df$v1,breaks=c(20,23,26,29,34))

my.df

my.stats<-aggregate(my.df[,c("v2","v3")], by=list(my.df$v1.class), length)
colnames(my.stats)<-c("v1.classs", "freq_v1", "freq_v2")
my.stats

my.stats<-cbind(my.stats, aggregate(my.df[,c("v2","v3")],
by=list(my.df$v1.class), mean))
colnames(my.stats)<-c("v1.classs", "freq_v1", "freq_v2", "rm1", "mean_v1",
"mean_v2")
my.stats

my.stats<-cbind(my.stats, aggregate(my.df[,c("v2","v3")],
by=list(my.df$v1.class), median))
colnames(my.stats)<-c("v1.classs", "freq_v1", "freq_v2", "rm1", "mean_v1",
"mean_v2",
 "rm2", "median_v1", "median_v2")
my.stats









On 7/23/08, Angelo Scozzarella <angeloscozzarella@tiscali.it> wrote:
>
> Thanks, but I want to calculate index like mean, median .....
>
>
> How can I do it?
>
>
> Angelo Scozzarella
>
>
>
>  Il giorno 23/lug/08, alle ore 20:46, milton ruser ha scritto:
>
>  I don´t know what you means by "treat", but may be you want something
> like
> my.df<-read.table(stdin(), head=T, sep=",")
> class,frequency
> 20-23,9
> 23-25,7
> 26-28,5
> 29-31,5
> 32-34,3
>
> rownames(my.df)<-my.df$class
> barplot (my.df$frequency)
> axis(1, 1:dim(my.df)[1], rownames(my.df))
>
> Cheers,
> miltinho astronauta
> brazil
>
>
>
> On 7/23/08, Angelo Scozzarella <angeloscozzarella@tiscali.it> wrote:
>>
>> Hi,
>>
>> how can I treat data organised in classes and frequencies?
>>
>> Ex.
>>
>> class           frequency
>>
>> 20-23                   9
>> 23-25                   7
>> 26-28                   5
>> 29-31                   5
>> 32-34                   3
>>
>>
>>
>> Thanks
>>
>> Angelo Scozzarella
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
>

	[[alternative HTML version deleted]]

