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$trust
 [1]  5.957510  5.888664  6.168135  6.419472  5.668796  6.026923
6.456721  7.017946  5.294411

[10]  7.296844  6.479167  5.009000  7.149073  5.932667  5.991000
5.327137  5.453230  5.650350
[19]  5.295608  5.518337  4.875000  6.637000  5.891014  6.726055
10.695650  5.490983  7.290476
[28]  5.728543  4.103689  8.421315
> des.trust <- sapply(as1$trust, range, na.rm=TRUE)
> des.trust
        [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
[,8]     [,9]    [,10]
[1,] 5.95751 5.888664 6.168135 6.419472 5.668796 6.026923 6.456721
7.017946 5.294411 7.296844
[2,] 5.95751 5.888664 6.168135 6.419472 5.668796 6.026923 6.456721
7.017946 5.294411 7.296844

        [,11] [,12]    [,13]    [,14] [,15]    [,16]   [,17]   [,18]
 [,19]    [,20] [,21]
[1,] 6.479167 5.009 7.149073 5.932667 5.991 5.327137 5.45323 5.65035
5.295608 5.518337 4.875
[2,] 6.479167 5.009 7.149073 5.932667 5.991 5.327137 5.45323 5.65035
5.295608 5.518337 4.875

     [,22]    [,23]    [,24]    [,25]    [,26]    [,27]    [,28]
[,29]    [,30]
[1,] 6.637 5.891014 6.726055 10.69565 5.490983 7.290476 5.728543
4.103689 8.421315
[2,] 6.637 5.891014 6.726055 10.69565 5.490983 7.290476 5.728543
4.103689 8.421315


tomii <t.klep...@gmail.com>

        [[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