Sent from my iPhone
On Mar 9, 2011, at 6:13 PM, David Winsemius wrote:
>
>
> Sent from my iPhone
>
> On Mar 9, 2011, at 5:59 PM, Tomii wrote:
>
>> I try to calculate descriptive statistics for one of the variables in the
>> data frame, however command sapply calculates these statistics fo
Hi:
Perhaps something like this?
m <- matrix(rnorm(100, m = 10, s = 2), ncol = 5)
colnames(m) <- paste('V', 1:5, sep = '')
# Summary function:
summs <- function(x) c(mean = mean(x), sd = sd(x), range = diff(range(x)))
# Apply to columns of m and transpose the result:
t(apply(m, 2, summs))
For
Sent from my iPhone
On Mar 9, 2011, at 5:59 PM, Tomii wrote:
> I try to calculate descriptive statistics for one of the variables in the
> data frame, however command sapply calculates these statistics for every
> value of the variable separately. How to make it calculate range (as well as
> o
I try to calculate descriptive statistics for one of the variables in the
data frame, however command sapply calculates these statistics for every
value of the variable separately. How to make it calculate range (as well as
other statistics) for all column?
Here are commands and results:
> as1$tr
4 matches
Mail list logo