Template

Author

Richard J. Acton

Published

July 17, 2023

Modified

July 17, 2023

Paper title

doi:

an image from paper, this becomes post thumbnail, place image in post directory or a dataset Alt text

Figure 1

Group members:

Figure …

Figures Example

Code
suppressPackageStartupMessages({
    library(dplyr)
    library(ggplot2)
    library(gt)
    library(datasauRus)
})

The Datasaurus Dozen

Code
datasaurus_dozen <- 
    datasaurus_dozen %>%
    dplyr::mutate(
        dataset = dataset %>% gsub("_", " ", .) %>% tools::toTitleCase()
    )

datasaurus_dozen %>%
    group_by(dataset) %>%
    summarise(
        `mean x` = mean(x),
        `mean y` = mean(y),
        `sd x` = sd(x),
        `sd y` = sd(y),
        `pearson correlation` = cor(x,y)
    ) %>%
    gt(rowname_col = "dataset") %>%
    tab_header(
        title = "The Datasaurus Dozen",
        subtitle = "Very Similar summary statistics..."
    )
The Datasaurus Dozen
Very Similar summary statistics...
mean x mean y sd x sd y pearson correlation
Away 54.26610 47.83472 16.76982 26.93974 -0.06412835
Bullseye 54.26873 47.83082 16.76924 26.93573 -0.06858639
Circle 54.26732 47.83772 16.76001 26.93004 -0.06834336
Dino 54.26327 47.83225 16.76514 26.93540 -0.06447185
Dots 54.26030 47.83983 16.76774 26.93019 -0.06034144
High Lines 54.26881 47.83545 16.76670 26.94000 -0.06850422
Slant Down 54.26785 47.83590 16.76676 26.93610 -0.06897974
Slant Up 54.26588 47.83150 16.76885 26.93861 -0.06860921
Star 54.26734 47.83955 16.76896 26.93027 -0.06296110
Wide Lines 54.26692 47.83160 16.77000 26.93790 -0.06657523
h Lines 54.26144 47.83025 16.76590 26.93988 -0.06171484
v Lines 54.26993 47.83699 16.76996 26.93768 -0.06944557
x Shape 54.26015 47.83972 16.76996 26.93000 -0.06558334
Code
datasaurus_dozen %>%
    ggplot(aes(x = x, y = y)) +  #  , colour = dataset
    geom_point() + 
    coord_equal() +
    facet_wrap(~dataset, ncol = 4) + 
    labs(title = "Datasaurus Dozen") + 
    theme_minimal()