Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use <code>rbind</code> and <code>colMeans</code> as in:</p> <pre><code>&gt; rbind(tbl_mut, colMeans=colMeans(tbl_mut)) timetE4_1 timetE1_2 timetE2_2 timetE3_2 timetE4_2 eve_mean mor_mean tot_mean 1 4048.605 59094.48 27675.59 26374.06 43310.01 7774.442 39113.53 23443.99 2 45729.986 139889.21 111309.64 129781.17 96924.62 43374.117 119476.16 81425.14 3 639686.154 1764684.16 1117027.29 1147967.45 1156442.48 585562.724 1296530.34 941046.53 4 4466.153 26250.32 20320.08 18413.54 29061.25 3866.547 23511.30 13688.92 colMeans 173482.724 497479.54 319083.15 330634.05 331434.59 160144.458 369657.83 264901.15 </code></pre> <p><strong>EDIT</strong></p> <p>Suppose your data is called <code>df</code> and looks like this:</p> <pre><code>&gt; df Description timetE4_1 timetE1_2 timetE2_2 timetE3_2 timetE4_2 eve_mean mor_mean tot_mean 1 A 4048.605 59094.48 27675.59 26374.06 43310.01 7774.442 39113.53 23443.99 2 B 45729.986 139889.21 111309.64 129781.17 96924.62 43374.117 119476.16 81425.14 3 C 639686.154 1764684.16 1117027.29 1147967.45 1156442.48 585562.724 1296530.34 941046.53 4 D 4466.153 26250.32 20320.08 18413.54 29061.25 3866.547 23511.30 13688.92 </code></pre> <p>where <code>Description</code> is factor variable, then you can do the following to obtain the colmeans.</p> <pre><code>&gt; suppressWarnings(rbind(df, colMeans=colMeans(df[, sapply(df, is.numeric)]))) Description timetE4_1 timetE1_2 timetE2_2 timetE3_2 timetE4_2 eve_mean mor_mean tot_mean 1 A 4048.605 59094.48 27675.59 26374.06 43310.01 7774.442 39113.53 23443.99 2 B 45729.986 139889.21 111309.64 129781.17 96924.62 43374.117 119476.16 81425.14 3 C 639686.154 1764684.16 1117027.29 1147967.45 1156442.48 585562.724 1296530.34 941046.53 4 D 4466.153 26250.32 20320.08 18413.54 29061.25 3866.547 23511.30 13688.92 colMeans &lt;NA&gt; 497479.542 319083.15 330634.05 331434.59 160144.46 369657.833 264901.15 173482.72 </code></pre> <p>Or just <code>suppressWarnings(rbind(df, colMeans=colMeans(df[, -1])))</code> if you know where the non-numeric variable is.</p>
    singulars
    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.
    3. VO
      singulars
      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