Skip to content

Commit

Permalink
new analysis of data with R
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanSC committed Jun 29, 2022
1 parent 3724cf4 commit c3adef5
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
library(tibble)
library(data.table)
library(dplyr)
Epigraphy <- read.csv('analysis/all_monument_with_location.csv')
install.packages("RSQLite")
library(RSQLite)
library(dplyr)
library(RSQLite)
install.packages("sqldf")
library(sqldf)
library(ggplot2)
install.packages("ggplot2")
install.packages("sqldf")
install.packages("ggrepel")
library(ggplot2)
library(ggrepel)
Epigraphy <- read.csv('analysis/all_monument_with_location.csv')
str(Epigraphy)
epigraphydf <- Epigraphy
View(epigraphydf)
View(epigraphydf)
str(epigraphydf)
View(Epigraphy)
View(Epigraphy)
allaltars <- sqldf ("Select * From Epigraphy
Where MonumentType = 'altar'")
View(allaltars)
allaltarsplace <- na.omit(allaltars %>%
select(Ancient_Site,LAT,LON) %>%
group_by(cleaned_place) %>%
count(Ancient_Site,LAT,LON) %>%
arrange(desc(n)))
allaltarsplace <- na.omit(allaltars %>%
select(Ancient_Site,LAT,LONG) %>%
group_by(Ancient_Site) %>%
count(Ancient_Site,LAT,LONG) %>%
arrange(desc(n)))
View(allaltarsplace)
(allaltars_ll <- st_as_sf(allaltarsplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))
library(tibble)
library(data.table)
library(dplyr)
library(sqldf)
library(ggplot2)
library(ggrepel)
(allaltars_ll <- st_as_sf(allaltarsplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))
install.packages(sf)
install.packages(Sf)
install.packages("sf")
library(sf)
(allaltars_ll <- st_as_sf(allaltarsplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))
install.packages("rnaturalearthdata","rnaturalearth","rnaturalearthhires")
install.packages("rnaturalearthdata")
install.packages("rnaturalearth")
install.packages("rnaturalearthhires")
world <- ne_countries(scale = "large", returnclass = "sf")
class(world)
world <- ne_countries(scale = "large", returnclass = "sf")
library("rnaturalearthdata")
library("rnaturalearth")
library("rnaturalearthhires")
world <- ne_countries(scale = "large", returnclass = "sf")
world <- ne_countries(scale = "large", returnclass = "sf")
install.packages("rnaturalearthhires", repos = "http://packages.ropensci.org", type = "source")
ggplot() +
geom_sf(data = allaltars_ll, aes(size = n), alpha=0.6, colour = '#cd2026') +
labs(size = 'Altars') +
ggtitle("Altars of Legio VII Soldiers in Dalmatia") +
coord_sf(default_crs = st_crs(4326), xlim = c(13, 21), ylim = c(41.5, 46))
allstela <- sqldf ("Select * From Epigraphy
Where MonumentType = 'stela'")
allstelaplace <- na.omit(allstela %>%
select(Ancient_Site,LAT,LONG) %>%
group_by(Ancient_Site) %>%
count(Ancient_Site,LAT,LONG) %>%
arrange(desc(n)))
(allstela_ll <- st_as_sf(allstelaplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))
ggplot() +
geom_sf(data = allstela_ll, aes(size = n), alpha=0.6, colour = '#cd2026') +
labs(size = 'Stelae') +
ggtitle("Stelae of Legio VII Soldiers in Dalmatia") +
coord_sf(default_crs = st_crs(4326), xlim = c(13, 21), ylim = c(41.5, 46))
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.~*
.Rproj.user
13 changes: 13 additions & 0 deletions BromansCoopey.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
65 changes: 65 additions & 0 deletions r_scripts/testing_db.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# making a scatter plot with data from Bromans Dataset
# source data: https://doi.org/10.6078/M7X34VK8
# Author: Ewan Coopey
# Creation: 29/06/2022
# Last Edit: 29/06/2022

library(tibble)
library(data.table)
library(dplyr)
library(sqldf)
library(ggplot2)
library(ggrepel)
library(sf)
library("rnaturalearthdata")
library("rnaturalearth")


Epigraphy <- read.csv('analysis/all_monument_with_location.csv')

str(Epigraphy)


allaltars <- sqldf ("Select * From Epigraphy
Where MonumentType = 'altar'")

allaltarsplace <- na.omit(allaltars %>%
select(Ancient_Site,LAT,LONG) %>%
group_by(Ancient_Site) %>%
count(Ancient_Site,LAT,LONG) %>%
arrange(desc(n)))

(allaltars_ll <- st_as_sf(allaltarsplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))

## plotting

ggplot() +
geom_sf(data = allaltars_ll, aes(size = n), alpha=0.6, colour = '#cd2026') +
labs(size = 'Altars') +
ggtitle("Altars of Legio VII Soldiers in Dalmatia") +
coord_sf(default_crs = st_crs(4326), xlim = c(13, 21), ylim = c(41.5, 46))

# now stela

allstela <- sqldf ("Select * From Epigraphy
Where MonumentType = 'stela'")

allstelaplace <- na.omit(allstela %>%
select(Ancient_Site,LAT,LONG) %>%
group_by(Ancient_Site) %>%
count(Ancient_Site,LAT,LONG) %>%
arrange(desc(n)))

(allstela_ll <- st_as_sf(allstelaplace, coords = c('LONG', 'LAT'), remove = FALSE,
crs = 4326, agr = "constant"))

## plotting

ggplot() +
geom_sf(data = allstela_ll, aes(size = n), alpha=0.6, colour = '#cd2026') +
labs(size = 'Stelae') +
ggtitle("Stelae of Legio VII Soldiers in Dalmatia") +
coord_sf(default_crs = st_crs(4326), xlim = c(13, 21), ylim = c(41.5, 46))

## now compare distribution between CPF and non CPF

0 comments on commit c3adef5

Please sign in to comment.