a quick and dirty vis

Jen asked me to throw together a vis on a dataset in ten minutes for an R-Ladies Sydney thing.

Charles T. Gray true
11-14-2018

# packages
library(tidyverse)

# get data 
beaches_data <- read_csv("~/Downloads/rain_temp_beachbugs.csv")

More info on this dataset here.

take a look at what we have to work with


skimr::skim(beaches_data)

Skim summary statistics
 n obs: 3690 
 n variables: 10 

── Variable type:character ────────────────────────────────────────────────────────
 variable missing complete    n min max empty n_unique
  council       0     3690 3690  16  16     0        2
   region       0     3690 3690  25  25     0        1
     site       0     3690 3690  11  23     0       11

── Variable type:Date ─────────────────────────────────────────────────────────────
 variable missing complete    n        min        max     median
     date       0     3690 3690 2013-01-02 2018-10-16 2016-01-22
 n_unique
      344

── Variable type:integer ──────────────────────────────────────────────────────────
  variable missing complete    n  mean     sd p0 p25 p50 p75 p100
 beachbugs      29     3661 3690 33.92 154.92  0   1   5  17 4900
     hist
 ▇▁▁▁▁▁▁▁

── Variable type:numeric ──────────────────────────────────────────────────────────
     variable missing complete    n   mean      sd     p0    p25
           id       0     3690 3690  25.87  2.08    22     24   
          lat       0     3690 3690 -33.93  0.028  -33.98 -33.95
         long       0     3690 3690 151.26  0.0079 151.25 151.26
      rain_mm      22     3668 3690   4.17  9.99     0      0   
 temp_airport       0     3690 3690  23.62  5.2     13.1   19.6 
    p50    p75   p100     hist
  26     27.4   29    ▃▃▃▃▆▃▇▃
 -33.92 -33.9  -33.89 ▃▃▇▁▁▇▃▆
 151.26 151.27 151.28 ▇▇▇▁▇▇▁▃
   0      2.8   62.2  ▇▁▁▁▁▁▁▁
  23.3   26.8   46.4  ▃▇▇▆▂▁▁▁

Lat and long! So, natural next question.

where are these data?


beaches_data %>% 
  leaflet::leaflet() %>% 
  leaflet::addTiles() %>% 
  leaflet::addCircleMarkers(lng = ~long, lat = ~lat)

What about the different sites?

temperature and rain relationship with beachbugs for the different sites


beaches_data %>% 
  ggplot(aes(x = temp_airport, y = rain_mm, colour = beachbugs, size = beachbugs)) +
  geom_point(alpha = 0.3) +
  facet_wrap(~ site)

Citation

For attribution, please cite this work as

Gray (2018, Nov. 14). measured.: a quick and dirty vis. Retrieved from https://fervent-hypatia-7b7343.netlify.com/posts/2018-11-14-quick-and-dirty-vis/

BibTeX citation

@misc{gray2018a,
  author = {Gray, Charles T.},
  title = {measured.: a quick and dirty vis},
  url = {https://fervent-hypatia-7b7343.netlify.com/posts/2018-11-14-quick-and-dirty-vis/},
  year = {2018}
}