Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The object <code>a</code> is class <code>integer</code>, <code>b</code> is class <code>data.frame</code>. A <code>data frame</code> is a <code>list</code> with certain properties and with class <code>data.frame</code> (<a href="http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames" rel="nofollow">http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames</a>). Many functions, including <code>summary</code>, handle objects of different classes differently (see that you can use <code>summary</code> on an object of class <code>lm</code> and it gives you something completely different). If you want to apply the function <code>summary</code> to every components in <code>b</code>, you could use <code>lapply</code>:</p> <pre><code>&gt; a &lt;- 0:628846 &gt; b &lt;- data.frame(b = 0:628846) &gt; class(a) [1] "integer" &gt; class(b) [1] "data.frame" &gt; names(b) [1] "b" &gt; length(b) [1] 1 &gt; summary(b[[1]]) # b[[1]] gives the first component of the list b Min. 1st Qu. Median Mean 3rd Qu. Max. 0 157200 314400 314400 471600 628800 &gt; class(b$b) [1] "integer" &gt; summary(b$b) Min. 1st Qu. Median Mean 3rd Qu. Max. 0 157200 314400 314400 471600 628800 &gt; lapply(b,summary) $b Min. 1st Qu. Median Mean 3rd Qu. Max. 0 157200 314400 314400 471600 628800 &gt; &gt; # example of summary on a linear model &gt; x &lt;- rnorm(100) &gt; y &lt;- x + rnorm(100) &gt; my.lm &lt;- lm(y~x) &gt; class(my.lm) [1] "lm" &gt; summary(my.lm) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -2.6847 -0.5460 0.1175 0.6610 2.2976 Coefficients: Estimate Std. Error t value Pr(&gt;|t|) (Intercept) 0.04122 0.09736 0.423 0.673 x 1.14790 0.09514 12.066 &lt;2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.9735 on 98 degrees of freedom Multiple R-squared: 0.5977, Adjusted R-squared: 0.5936 F-statistic: 145.6 on 1 and 98 DF, p-value: &lt; 2.2e-16 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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