Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can write your own function to get such a summary into a data.frame:</p> <pre><code># Defining the function my.summary &lt;- function(x, na.rm=TRUE){ result &lt;- c(Mean=mean(x, na.rm=na.rm), SD=sd(x, na.rm=na.rm), Median=median(x, na.rm=na.rm), Min=min(x, na.rm=na.rm), Max=max(x, na.rm=na.rm), N=length(x)) } # identifying numeric columns ind &lt;- sapply(df, is.numeric) # applying the function to numeric columns only sapply(df[, ind], my.summary) Distance Age Height Mean 58.67200 11.840000 1.9160000 SD 45.48137 4.604168 0.9796626 Median 48.80000 13.500000 1.7000000 Min 8.70000 4.000000 0.6000000 Max 241.80000 19.000000 5.0000000 N 50.00000 50.000000 50.0000000 </code></pre> <p>Or you can use the built-in function <code>basicStats</code> from fBasics package for a more detailed summary:</p> <pre><code>&gt; library(fBasics) &gt; basicStats(df[, ind]) Distance Age Height nobs 50.000000 50.000000 50.000000 NAs 0.000000 0.000000 0.000000 Minimum 8.700000 4.000000 0.600000 Maximum 241.800000 19.000000 5.000000 1. Quartile 28.300000 7.000000 1.125000 3. Quartile 74.675000 15.750000 2.475000 Mean 58.672000 11.840000 1.916000 Median 48.800000 13.500000 1.700000 Sum 2933.600000 592.000000 95.800000 SE Mean 6.432037 0.651128 0.138545 LCL Mean 45.746337 10.531510 1.637583 UCL Mean 71.597663 13.148490 2.194417 Variance 2068.555118 21.198367 0.959739 Stdev 45.481371 4.604168 0.979663 Skewness 1.711028 -0.158853 0.905415 Kurtosis 3.753948 -1.574527 0.578684 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload