Hi AK
That works. I was trying to get  similar results from any other package.
Being a beginner, I was not sure how to modify the syntax to get my output.

lapply(split(BP_2bSexNoMV,BP_
2bSexNoMV$Sex),function(x) (nrow(x[!complete.cases(x[,-2]),])/nrow(x))*100)
#gives the percentage of rows of missing #values from the overall rows for
Males and Females
#$Female
#[1] 72.65522
#
#$Male
#[1] 74.47401

#iF you want the percentage from the total number rows in Males and Females
(without NA's in the the Sex column)
 lapply(split(BP_2bSexNoMV,BP_2bSexNoMV$Sex),function(x)
(nrow(x[!complete.cases(x[,-2]),])/nrow(BP_2bSexNoMV))*100)
#$Female
#[1] 35.14377
#
#$Male
#[1] 38.45048

How do I interpret the above 2 difft results? 72.66% of values were missing
among female participants?? Can you pl. clarify.

Many thanks.

On Sun, Jan 13, 2013 at 3:28 AM, arun <smartpink...@yahoo.com> wrote:

> lapply(split(BP_2bSexNoMV,BP_2bSexNoMV$Sex),function(x)
> (nrow(x[!complete.cases(x[,-2]),])/nrow(x))*100) #gives the percentage of
> rows of missing #values from the overall rows for Males and Females
> #$Female
> #[1] 72.65522
> #
> #$Male
> #[1] 74.47401
>
> #iF you want the percentage from the total number rows in Males and
> Females (without NA's in the the Sex column)
>  lapply(split(BP_2bSexNoMV,BP_2bSexNoMV$Sex),function(x)
> (nrow(x[!complete.cases(x[,-2]),])/nrow(BP_2bSexNoMV))*100)
> #$Female
> #[1] 35.14377
> #
> #$Male
> #[1] 38.45048
>

        [[alternative HTML version deleted]]

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to