library(flexdashboard)
library(ggplot2)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ tibble  3.1.8     ✔ dplyr   1.1.0
## ✔ tidyr   1.3.0     ✔ stringr 1.5.0
## ✔ readr   2.1.4     ✔ forcats 1.0.0
## ✔ purrr   1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(knitr)
library(magick)
## Warning: package 'magick' was built under R version 4.2.3
## Linking to ImageMagick 6.9.12.3
## Enabled features: cairo, freetype, fftw, ghostscript, heic, lcms, pango, raw, rsvg, webp
## Disabled features: fontconfig, x11
library(sunburstR)
library(gridExtra)
## Warning: package 'gridExtra' was built under R version 4.2.3
## 
## Attaching package: 'gridExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     combine

Problem Set 12: Advanced visualizations and analysis

UtopiaII<-read.csv("C:/Users/katie/Desktop/QuantProject/UtopiaIICLEAN.csv")

UtopiaII$Vessel..<-UtopiaII$Artifact.ID
SlaveQuarterVessels<-read.csv("C:/Users/katie/Desktop/QuantProject/SlaveQuarterVesselsClean.csv")

chart

U<-ggplot(UtopiaII, aes(Category)) + geom_bar() + coord_flip() + ggtitle("Utopia II Categories")
SQ<-ggplot(SlaveQuarterVessels, aes(Category)) + geom_bar() + coord_flip() + ggtitle("Slave Quarter Categories")

grid.arrange(U, SQ, ncol=2)

This is pretty basic but is an interesting visual for the Utopia II site. There are far more earthenwares when compared with the other sites I am looking at. I made two versions of this

U2<-ggplot(UtopiaII, aes(Category)) + geom_bar() 
SQ2<-ggplot(SlaveQuarterVessels, aes(Category)) + geom_bar() 

grid.arrange(U2, SQ2, ncol=2)

Analyze a dataset of your choice

-clustering of category/ware at site -frequency of different decoration types -frequency of glazed not glazed -frequency of hollow ware v. flatware

#Int..Dec..1..Method
ggplot(SlaveQuarterVessels, aes(Int..Dec..1..Method)) + geom_bar() + coord_flip()

This data is not very clean, I have worked to clean it up but many of the categories haven’t been transferring very well. Aside from that I think it is interesting considering the number of ceramics where no interior decoration is listed in the catalog. At first this seems like something could be wrong with the catalog until realizing this instead more likely has something to do with the number of unglazed earthenwares at the site. However I would want to check the catalog and actual artifacts before doing much with the data.

Create and interpret an interactive graphic of choice

action <- UtopiaII %>%
  group_by(Vessel..) %>%
  filter(row_number() == 1) %>%
  summarize(Observation = paste(c(Category[!is.na(Category)],Ware.Type),collapse="-"))
#action
sequences <- action %>%
  ungroup() %>%
  group_by(Observation) %>%
  summarize(count = n())
#sequences
sequences$depth <- unlist(lapply(strsplit(sequences$Observation,"-"),length))

Uii  <- sequences %>%
  arrange(desc(depth), Observation) %>%
  sunburst(count = TRUE, 
  legend = TRUE, explanation = "function(d){return d.data.name}") 
Uii
Legend

Again interesting visualization with the Utopia II site ceramic data. While there isn’t much stoneware there is a great deal of variability in types when compared to the other ceramic categories. I really like sunburst charts to represet data at a given site. I hope I am able to reine this a bit more and make the colorschemes and lables work in the next few days.