library(gt)
gt(mtcars) %>%
gtsave("test.rtf")
UQRUG 24
meeting
2022-02-23: UQRUG 24
Attendees
- Stéphane Guillou: just helping out
- Svetlina Vasileva
- Trinh Huynh (USC)
- Richard Bell
- Luke Gaiter (ggplot2 lesson)
- …and 5 other UQRUGers!
Code
Convert a table to a gt
object and then save it to RTF (which can be opened by Word).
Attempting to highlight/label outliers in linear regression plot
### geom_text_repel
# only label players with QoG > 1 or < 0.2
# align text vertically with nudge_y and allow the labels to
# move horizontally with direction = "x"
ggplot(linear_regression, aes(x= QOG, y = ten_political_conflict, label = district)) +
geom_point(color = dplyr::case_when(linear_regression$QOG > 1 ~ "#1b9e77",
$QOG < 0.2 ~ "#d95f02",
linear_regressionTRUE ~ "#7570b3"),
size = 3, alpha = 0.8) +
geom_text_repel(data = subset(linear_regression, QOG > 1),
nudge_y = 32 - subset(linear_regression, QOG > 1)$QOG,
size = 4,
box.padding = 1.5,
point.padding = 0.5,
force = 100,
segment.size = 0.2,
segment.color = "grey50",
direction = "x") +
geom_label_repel(data = subset(linear_regression, QOG < 0.2),
nudge_y = 16 - subset(linear_regression, QOG < 0.2)$QOG,
size = 4,
box.padding = 0.5,
point.padding = 0.5,
force = 100,
segment.size = 0.2,
segment.color = "grey50",
direction = "x") +
scale_x_continuous(expand = expansion(mult = c(0.2, .2))) +
scale_y_continuous(expand = expansion(mult = c(0.1, .1))) +
theme_classic(base_size = 16)