“There is no try, you do or do not.” Jedi Master Yoda
My favourite package in tidyverese is dplyr. Here is the link to the documentation.
Here is the last plot I made with ggplot:
library(tidyverse)
library(here)
library(tinytex)
clean_ndl <- read_csv("J:/Dropbox/Ophthalmology/Stats/RProjects/RDemo/data/ndl_clean.csv")
glimpse(clean_ndl)
## Observations: 133
## Variables: 11
## $ Age <dbl> 63, 69, 67, 62, 66, 85, 80, 66, 89, 69, 75, 88, 76, 81, 8...
## $ Gender <chr> "M", "M", "F", "F", "F", "F", "F", "M", "F", "F", "F", "F...
## $ Ethnicity <chr> "White", "Asian", "White", "White", "White", NA, "White",...
## $ CCT <dbl> NA, 489, NA, 511, 514, 537, 545, 511, 523, 583, 461, NA, ...
## $ IOP_max <dbl> NA, 32, 37, 31, 27, 32, 39, 34, 34, 26, 21, 36, NA, NA, N...
## $ IOP_pre <dbl> 20, 24, 23, 20, 25, 20, 22, 20, 24, 18, 15, 20, 22, 21, 2...
## $ Date <dttm> 2011-07-04, 2008-10-07, 2008-07-15, 2005-04-12, 2008-11-...
## $ Year <dbl> 2011, 2008, 2008, 2005, 2008, 2013, 2013, 2006, 2011, 201...
## $ Month <chr> "07", "10", "07", "04", "11", "06", "01", "09", "02", "05...
## $ Day <chr> "04", "07", "15", "12", "04", "19", "22", "26", "08", "12...
## $ IOP_6m <dbl> 14, NA, 19, NA, 11, NA, 14, 16, 14, 13, 13, 10, 19, NA, N...
clean_ndl %>%
filter(!Ethnicity %in% c("Pakistani", "Other"),
!is.na(Ethnicity)) %>%
ggplot(aes(x = Ethnicity, y = IOP_pre)) +
geom_boxplot() +
theme_classic()