I am new (very new) to R.
I am working on demographic data frame (POP) of 4 variables : population (int), age(numeric), gender (factor), region (factor) and would like to summarise age by region.
I found the describeBy function but the results in each group are those of the global population.
describeBy(POP$age,group=POP$region)
There must be a stupid error somewhere. Thank you for your help
Trying some code description (but not sure how it will appear) GLobal description:
summary(POP$age)  
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00   13.75   27.50   27.50   41.25   55.00 
Group description:
> describeBy(POP$age,group=POP$region)
group: REGION1
   vars   n mean    sd median trimmed   mad min max range skew kurtosis   se
X1    1 112 27.5 16.24   27.5    27.5 20.76   0  55    55    0    -1.23 1.53
-------------------------------------------------------------------------- 
group: REGION2
   vars   n mean    sd median trimmed   mad min max range skew kurtosis   se
X1    1 112 27.5 16.24   27.5    27.5 20.76   0  55    55    0    -1.23 1.53
-------------------------------------------------------------------------- 
group: REGION3
   vars   n mean    sd median trimmed   mad min max range skew kurtosis   se
X1    1 112 27.5 16.24   27.5    27.5 20.76   0  55    55    0    -1.23 1.53
-------------------------------------------------------------------------- 
etc...
 
    