Skip to content
Back to formatted view

Raw Message

Message-ID: <D3518130-9288-4F97-A5CD-A14B6A713504@comcast.net>
Date: 2012-11-25T00:14:24Z
From: David Winsemius
Subject: Summary statistics for matrix columns
In-Reply-To: <BAY173-W38A45D8F4C51EDEF6F18B6A7590@phx.gbl>

On Nov 24, 2012, at 4:58 AM, frespider wrote:

>
>
> HI A.k,
>
> I need one more question, if you can answer it please
>
> M <- matrix(sample(1:8000),nrow=100)
> colnames(M)<- paste("Col",1:ncol(M),sep="")
> apply(M,2,function(x) c(Min=min(x),"1st Qu" =quantile(x,  
> 0.25,names=FALSE),
>                        Range = range(x),
>                        Median = quantile(x, 0.5, names=FALSE),
>                        Mean= mean(x),Std=sd(x),
>                        "3rd Qu" = quantile(x,0.75,names=FALSE),
>                        IQR=IQR(x),Max = max(x)))
>
> why I get two range . isn't range mean the different between the max  
> and min

If you want the "span" (what you are calling the range) of the range  
(min and max) you can do this:

myRange = diff(range(x))

-- 
David
>
>
>

David Winsemius, MD
Alameda, CA, USA