Search code examples
router-join

How to reproduce a table of student?


enter image description here

I have to produce a document that looks as much like this student chart as possible using in particular the "outer" function, but I don't know how to do that.


Solution

  • Something like

    x <- 1:20; names(x) <-x
    y <- c(0.05, 0.025, 0.01, 0.005, 0.001, 0.0005); names(y) <- y
    outer(x, y,function(x, y) {abs(qt(y, df=x))})
    #>        0.05     0.025      0.01     0.005      0.001      5e-04
    #> 1  6.313752 12.706205 31.820516 63.656741 318.308839 636.619249
    #> 2  2.919986  4.302653  6.964557  9.924843  22.327125  31.599055
    #> 3  2.353363  3.182446  4.540703  5.840909  10.214532  12.923979
    #> 4  2.131847  2.776445  3.746947  4.604095   7.173182   8.610302
    #> 5  2.015048  2.570582  3.364930  4.032143   5.893430   6.868827
    #> 6  1.943180  2.446912  3.142668  3.707428   5.207626   5.958816
    #> 7  1.894579  2.364624  2.997952  3.499483   4.785290   5.407883
    #> 8  1.859548  2.306004  2.896459  3.355387   4.500791   5.041305
    #> 9  1.833113  2.262157  2.821438  3.249836   4.296806   4.780913
    #> 10 1.812461  2.228139  2.763769  3.169273   4.143700   4.586894
    #> 11 1.795885  2.200985  2.718079  3.105807   4.024701   4.436979
    #> 12 1.782288  2.178813  2.680998  3.054540   3.929633   4.317791
    #> 13 1.770933  2.160369  2.650309  3.012276   3.851982   4.220832
    #> 14 1.761310  2.144787  2.624494  2.976843   3.787390   4.140454
    #> 15 1.753050  2.131450  2.602480  2.946713   3.732834   4.072765
    #> 16 1.745884  2.119905  2.583487  2.920782   3.686155   4.014996
    #> 17 1.739607  2.109816  2.566934  2.898231   3.645767   3.965126
    #> 18 1.734064  2.100922  2.552380  2.878440   3.610485   3.921646
    #> 19 1.729133  2.093024  2.539483  2.860935   3.579400   3.883406
    #> 20 1.724718  2.085963  2.527977  2.845340   3.551808   3.849516
    

    Created on 2022-01-23 by the reprex package (v2.0.1)

    Please extend x to desired length then use any fancy table style for styling.