How to Read a Standard R Table

From Q
Jump to: navigation, search

Many Standard R outputs contain a default output which is a table, similar to the two below.

Coefficient tables

Statistical models that estimate coefficients are often represented in Standard R with a table such as the one below. Key aspects of this table are:

  • The estimated parameters, which are referred to as Estimates in the example below, are color-coded where the corresponding p-value is less than 0.05. If the coefficient is positive they are colored blue. If negative, they are colored red.
  • The t or z-statistics are colored from coral (a pink color) through to blue, where:
    • Values less than -5 are shown in the strong coral (e.g., as shown in the sleepy row below.
    • Values of 0 are shown with white background.
    • Values of 5 or more are shown in blue.
    • Values between -5 and 5 are interpolated based on the z and t statistics.
  • p-Values are shown in the column marked p. They are bold where p is less than 0.05.

Tables of means

The table below shows means by group, where the rows represent variables, and the initial columns represent different sub-groups in the population. As with the Coefficient tables, the shading is determined by the t-statistics (computed as differences from the row means). However, whereas in the table above the t-statistics themselves were shaded, in this example the means are shaded according to the t-statistics, and the t-statistics themselves are not displayed. See Classifier - Linear Discriminant Analysis for a more detailed discussion of this example.

Acknowledgements

The formatting of the table is primarily via the formattable (Ren and Russell 2016) package, with some assistance from rmarkdown (Allaire et al. 2016), htmltools (RStudio Inc. 2016)) and htmlwidgets (Vaidyanathan et al. 2016).

References

JJ Allaire, Joe Cheng, Yihui Xie, Jonathan McPherson, Winston Chang, Jeff Allen, Hadley Wickham, Aron Atkins and Rob Hyndman (2016). rmarkdown: Dynamic Documents for R. R package version 0.9.6. https://CRAN.R-project.org/package=rmarkdown

Ramnath Vaidyanathan, Yihui Xie, JJ Allaire, Joe Cheng and Kenton Russell (2016). htmlwidgets: HTML Widgets for R. R package version 0.6. https://CRAN.R-project.org/package=htmlwidgets

Kun Ren and Kenton Russell (2016). formattable: Create 'Formattable' Data Structures. R package version 0.2.0.1. https://CRAN.R-project.org/package=formattable

RStudio Inc. (2016). htmltools: Tools for HTML. R package version 0.3.5. https://CRAN.R-project.org/package=htmltools