Dear Arun and Rui, thank you for replying, your commands are very helpful.
Before you replied, Ive solved the issue with the following approach (for
quartiles):
myFun <- function(x, GENDER)
{
x.male <- cut(x, labels=c(1:4), breaks=quantile(split(x,GENDER) $ '1',
seq(0,1,.25), na.rm=TRUE),incl
64 5
A.K.
- Original Message -
From: Rui Barradas
To: R Kozarski
Cc: r-help@r-project.org
Sent: Friday, November 30, 2012 1:07 PM
Subject: Re: [R] subgroup-based quantiles
Hello,
If you want Age quantiles by gender, you have to split the data by
gender, apply the same code t
1
#2 1 5810
#3 1 54 1
#4 2 7110
#5 2 64 5
A.K.
- Original Message -
From: Rui Barradas
To: R Kozarski
Cc: r-help@r-project.org
Sent: Friday, November 30, 2012 1:07 PM
Subject: Re: [R] subgroup-based quantiles
Hello,
If you
Hello,
If you want Age quantiles by gender, you have to split the data by
gender, apply the same code then recombine the result.
fun <- function(x){
Age_group <- cut(x[, "Age"], labels=c(1:10),
breaks=quantile(x[, "Age"], seq(0,1,.1)),
include.lowest = TRUE)
cbind(x, A
Dear R users,
given the patient sample with their Gender and Age
GENDER Age
[1,] 2 45
[2,] 1 58
[3,] 1 54
[4,] 2 71
[5,] 2 64
...
I would like to create an another column which groups the patients wrt
Gender specific Age quantiles, following me
5 matches
Mail list logo