The 'Archdata' Package for R

A number of very useful datasets containing archaeological data have been collected together into a single package by David L. Carlson and Georg Roth. You can find the information about the package at the cran archive. In this notebook, we've already installed the package when the Binder was created. We will invoke it with the library command, and then do a few example visualizations and calculations.

At the end of this notebook, we have provided the code to load up mineralogical data from Graham's 2002 thesis, and we encourage you to explore it by copying and modifying the other example code. Add cells explaining what each code block is doing; you will need to search the various functions. You should try to find their actual manual pages, as well as other tutorials and blog posts where people are using these functions (add markdown links to make your text readable).

In [27]:
# to find out what's in this package, run the following
?archdata

# or go to
# https://cran.rstudio.com/web/packages/archdata/archdata.pdf
In [19]:
library("archdata")
In [21]:
data("RBGlass1")
RBGlass1
SiteAlFeMgCaNaKTiPMnSbPb
Mancetter2.51 0.53 0.56 6.98 17.44 0.73 0.09 0.15 0.58 0.12 0.03
Mancetter2.36 0.49 0.53 6.71 17.69 0.68 0.09 0.13 0.40 0.23 0.04
Mancetter2.30 0.36 0.49 8.10 15.94 0.68 0.07 0.13 0.77 0.00 0.01
Mancetter2.42 0.52 0.56 6.93 17.59 0.72 0.09 0.14 0.47 0.18 0.02
Mancetter2.32 0.37 0.51 7.51 16.27 0.69 0.07 0.13 0.21 0.00 0.02
Mancetter2.34 0.56 0.52 6.10 18.61 0.69 0.10 0.11 0.30 0.32 0.03
Mancetter2.50 0.46 0.50 6.83 17.46 0.79 0.08 0.15 0.40 0.06 0.02
Mancetter2.47 0.53 0.55 6.55 18.55 0.75 0.09 0.12 0.35 0.23 0.04
Mancetter2.41 0.67 0.62 6.18 18.33 0.81 0.12 0.14 0.52 0.31 0.07
Mancetter2.64 0.50 0.63 7.76 15.66 0.63 0.08 0.16 0.21 0.00 0.01
Mancetter2.77 0.58 0.50 7.33 16.10 0.68 0.08 0.14 0.57 0.00 0.01
Mancetter2.43 0.69 0.72 6.27 17.84 0.98 0.12 0.22 0.63 0.13 0.04
Mancetter2.50 0.36 0.53 8.51 15.46 0.60 0.07 0.16 0.45 0.00 0.01
Mancetter2.63 0.46 0.47 7.25 16.26 0.59 0.07 0.12 0.30 0.00 0.01
Mancetter2.66 0.41 0.50 7.35 17.12 0.63 0.07 0.15 0.11 0.00 0.01
Mancetter2.43 0.62 0.52 6.89 17.17 0.69 0.08 0.13 0.44 0.18 0.05
Mancetter2.55 0.53 0.52 7.91 16.20 0.62 0.07 0.15 0.38 0.00 0.01
Mancetter2.44 0.54 0.56 6.65 17.68 0.97 0.10 0.12 0.40 0.25 0.03
Mancetter2.22 0.34 0.46 7.08 16.14 0.63 0.06 0.15 0.12 0.00 0.01
Mancetter2.59 0.37 0.46 7.57 15.71 0.56 0.07 0.16 0.07 0.00 0.01
Mancetter2.45 0.48 0.55 6.84 17.73 0.76 0.09 0.14 0.62 0.14 0.05
Mancetter2.42 0.49 0.51 7.00 16.32 0.93 0.08 0.14 0.42 0.10 0.03
Mancetter2.27 0.38 0.48 7.88 16.28 0.52 0.07 0.14 0.26 0.00 0.01
Mancetter2.48 0.55 0.55 6.64 18.76 0.75 0.09 0.12 0.36 0.24 0.04
Leicester2.27 0.32 0.39 6.75 17.95 0.75 0.07 0.12 0.18 0.00 0.01
Leicester2.32 0.84 0.55 6.19 19.78 0.70 0.10 0.11 0.24 0.37 0.08
Mancetter2.46 0.49 0.54 6.82 18.07 0.75 0.08 0.13 0.60 0.13 0.04
Mancetter2.67 0.34 0.49 6.94 18.04 0.54 0.06 0.11 0.44 0.00 0.01
Mancetter2.47 0.42 0.51 7.57 17.94 0.76 0.07 0.14 0.41 0.00 0.01
Mancetter2.40 0.45 0.54 7.62 17.76 0.64 0.08 0.13 0.40 0.11 0.02
Leicester2.31 0.88 0.57 6.42 18.90 0.76 0.10 0.12 0.28 0.30 0.03
Leicester2.50 0.78 0.56 6.46 18.57 0.73 0.11 0.12 0.26 0.27 0.03
Leicester2.57 0.80 0.56 6.43 18.41 0.75 0.12 0.12 0.26 0.26 0.03
Leicester2.24 0.84 0.56 6.26 19.49 0.73 0.09 0.12 0.23 0.32 0.03
Leicester2.37 0.44 0.50 6.78 17.15 0.70 0.08 0.15 0.45 0.06 0.02
Leicester2.48 0.77 0.55 6.36 18.30 0.73 0.11 0.12 0.26 0.26 0.03
Leicester2.26 0.58 0.61 6.16 19.47 0.74 0.10 0.11 0.21 0.43 0.03
Leicester2.59 0.48 0.60 8.76 14.50 0.51 0.07 0.13 0.27 0.00 0.01
Leicester2.25 0.66 0.52 6.20 18.06 0.64 0.09 0.11 0.24 0.31 0.04
Leicester2.43 0.48 0.56 7.60 15.57 0.62 0.08 0.16 0.49 0.00 0.01
Leicester2.49 0.93 0.55 6.18 16.54 1.10 0.12 0.13 0.25 0.28 0.03
Leicester2.46 0.76 0.55 6.37 17.95 0.72 0.11 0.12 0.26 0.27 0.03
Leicester2.47 1.05 0.56 7.62 17.02 0.70 0.11 0.14 0.26 0.23 0.03
Leicester2.16 0.74 0.53 6.09 17.25 0.65 0.09 0.11 0.25 0.32 0.03
Leicester2.26 0.58 0.52 6.41 17.28 0.67 0.09 0.13 0.28 0.25 0.03
Leicester2.29 0.78 0.56 6.24 18.45 0.70 0.10 0.11 0.26 0.32 0.03
Leicester2.30 0.78 0.53 6.28 18.20 0.65 0.10 0.11 0.25 0.31 0.03
Leicester2.52 0.65 0.55 6.16 18.69 0.74 0.11 0.10 0.29 0.33 0.06
Leicester2.28 0.68 0.55 6.37 18.60 0.68 0.10 0.11 0.24 0.32 0.03
Leicester2.25 0.62 0.56 5.55 19.47 0.74 0.13 0.11 0.31 0.42 0.05
Leicester2.32 0.80 0.54 6.34 18.25 0.66 0.10 0.11 0.25 0.32 0.03
Leicester2.35 0.74 0.55 6.54 18.44 0.71 0.10 0.11 0.26 0.29 0.03
Leicester2.45 0.42 0.61 9.79 16.22 0.62 0.08 0.13 0.14 0.00 0.01
Leicester2.19 0.84 0.54 6.13 17.99 0.69 0.10 0.11 0.24 0.33 0.04
Leicester2.62 0.82 0.54 6.25 17.79 0.73 0.11 0.09 0.29 0.32 0.04
Leicester2.35 0.65 0.54 6.73 17.91 0.72 0.10 0.12 0.28 0.25 0.06
Leicester2.44 0.35 0.51 7.70 16.27 0.62 0.07 0.13 0.16 0.00 0.01
Leicester2.42 0.68 0.53 6.15 17.19 0.77 0.13 0.11 0.27 0.26 0.03
Leicester2.52 0.79 0.56 6.37 18.11 0.74 0.12 0.11 0.26 0.27 0.03
Leicester2.37 0.75 0.55 6.33 18.55 0.69 0.10 0.11 0.25 0.32 0.03
In [16]:
RBGlass1.pca <- prcomp(RBGlass1[, -1], scale.=TRUE)
Error in prcomp(RBGlass1[, -1], scale. = TRUE): object 'RBGlass1' not found
Traceback:

1. prcomp(RBGlass1[, -1], scale. = TRUE)
In [14]:
biplot(RBGlass1.pca, xlabs=abbreviate(RBGlass1$Site, 1), cex=.75)
In [31]:
PitHouses
HearthsDepthSizeFormOrientEntrance
Two Deep Medium Rectangular Parallel Coast None
One Deep Small Rectangular Parallel Coast None
Two Deep Small Rectangular Parallel Coast None
None Shallow Small Rectangular Parallel Coast One Side
Two Shallow Medium Rectangular Parallel Coast Front and One Side
None Shallow Medium Rectangular Parallel Coast Front and One Side
Charcoal Conc Shallow Medium Rectangular Parallel Coast One Side
One Deep Medium Rectangular Parallel Coast None
One Deep Small Rectangular Parallel Coast None
One Shallow Small Rectangular Gabel Toward CoastOne Side
One Deep Small Rectangular Parallel Coast None
Charcoal Conc Shallow Medium Rectangular Parallel Coast None
Charcoal Conc Shallow Large Rectangular Parallel Coast None
Two Deep Large Rectangular Parallel Coast None
None Deep Small Oval Parallel Coast One Side
One Deep Medium Oval Parallel Coast None
Charcoal Conc Deep Small Rectangular Parallel Coast One Side
Two Deep Medium Rectangular Parallel Coast None
One Shallow Medium Oval Parallel Coast One Side
None Shallow Large Rectangular Parallel Coast None
Two Shallow Medium Rectangular Parallel Coast None
Two Deep Medium Rectangular Parallel Coast None
Charcoal Conc Shallow Medium Oval Gabel Toward CoastNone
None Deep Medium Oval Parallel Coast None
Two Shallow Medium Rectangular Parallel Coast None
Two Shallow Medium Rectangular Parallel Coast None
None Shallow Medium Rectangular Gabel Toward CoastNone
Charcoal Conc Shallow Medium Oval Parallel Coast None
Two Deep Medium Rectangular Parallel Coast None
Two Deep Medium Oval Parallel Coast None
Two Deep Small Rectangular Parallel Coast None
Two Deep Small Rectangular Parallel Coast One Side
None Deep Small Rectangular Parallel Coast None
Charcoal Conc Deep Small Rectangular Gabel Toward CoastNone
Charcoal Conc Shallow Medium Rectangular Parallel Coast None
One Deep Small Rectangular Parallel Coast None
Two Shallow Medium Rectangular Parallel Coast None
Charcoal Conc Deep Small Rectangular Parallel Coast None
Charcoal Conc Deep Small Rectangular Parallel Coast None
Two Deep Small Rectangular Parallel Coast None
One Deep Small Rectangular Parallel Coast None
Charcoal Conc Deep Small Rectangular Gabel Toward CoastNone
Charcoal Conc Deep Small Rectangular Parallel Coast None
Charcoal Conc Shallow Small Rectangular Parallel Coast None
Charcoal Conc Deep Small Rectangular Gabel Toward CoastNone
In [32]:
data(PitHouses)
# Crosstabulation of Hearths with Size
PitHouses.tbl <- xtabs(~Hearths+Size, PitHouses)
PitHouses.tbl
barplot(PitHouses.tbl, ylab="Frequency", main="Arctic Norway Pithouses", beside=TRUE,legend.text=TRUE, args.legend=list(title="Hearths"))
               Size
Hearths         Small Medium Large
  None              3      3     1
  One               6      3     0
  Two               4     10     1
  Charcoal Conc     8      5     1
In [23]:
data(Fibulae)
Fibulae
GraveMnoFLBHBFAFACDBRAEDFELCBWBTFEWCoilsLength
149 389 93 24 7 10 16 1 13 31 47 3.5 3.5 NA 4 114
190 615 21 7 6 9 6 5 2 11 10 3.5 1.7 NA 12 35
161 125 33 15 2 8 7 3 8 10 20 3.9 3.2 NA 4 60
31 812 23 26 4 7 9 5 12 1 16 6.2 7.7 2.8 4 74
49 798 20 23 2 8 7 1 8 5 16 7.7 5.2 2.6 6 68
6 673 27 15 6 8 7 5 3 11 11 3.7 3.5 1.8 4 55
Thames Thames 10 16 1 10 9 1 7 0 11 6.1 4.1 0.0 4 45
23 643 15 18 1 10 10 1 5 0 15 3.5 3.5 0.0 4 40
149 391 31 13 4 9 7 4 5 11 18 17.6 1.4 3.6 6 54
149 398 19 17 1 7 6 2 6 10 12 9.2 6.6 3.9 6 39
101 491 41 23 3 8 11 3 14 15 24 7.3 5.8 8.6 6 71
171 149 47 17 5 9 10 4 8 14 26 5.8 4.7 6.0 6 78
130 545 29 15 3 8 6 3 6 10 17 11.7 3.9 6.4 6 47
157 85 23 13 3 8 6 2 10 7 15 5.2 2.7 5.4 12 41
97 478 20 15 1 7 5 1 12 4 12 4.7 4.8 3.5 6 38
85 436 17 16 1 7 7 1 8 3 11 5.1 3.5 2.2 6 44
91 464 20 15 2 7 7 3 6 10 12 5.5 3.8 3.9 6 50
61 821 20 13 5 8 5 2 10 5 10 4.4 4.4 5.1 6 36
94 474 21 18 2 9 9 1 5 6 15 8.1 2.3 1.9 4 49
121 348 28 17 1 10 10 2 8 6 20 2.5 2.6 2.2 4 53
181 212 94 15 7 10 12 5 11 31 50 4.3 4.3 NA 6 128
68 587 22 18 1 8 7 1 5 8 17 8.8 3.0 2.4 6 59
61 830 20 14 1 8 6 1 3 4 14 14.3 1.4 1.7 6 44
130 549 22 15 3 8 7 3 13 1 17 5.0 4.6 2.5 10 47
80 529 12 22 1 6 9 1 9 0 11 6.8 6.4 0.0 4 45
149 399 27 15 1 8 10 2 9 11 19 8.2 4.0 7.6 4 53
48 788 15 19 2 8 7 3 3 4 12 3.7 3.5 1.9 4 56
44 752 10 10 2 10 6 2 2 NA 9 2.0 2.3 2.2 3 26
HallstattHallstatt 9 13 3 10 4 4 9 0 8 9.6 5.0 0.0 22 28
193 611 68 18 7 9 9 7 3 50 18 9.3 6.5 NA 4 110
In [44]:
t(sapply(Fibulae[, 3:16], quantile, na.rm=TRUE))
plot(density(Fibulae$Length, bw="SJ"), main="Kernel Density Plot of Length")
0%25%50%75%100%
FL 9.0 19.25 21.50 28.750 94.0
BH 7.0 15.00 15.50 18.000 26.0
BFA 1.0 1.00 2.00 4.000 7.0
FA 6.0 8.00 8.00 9.000 10.0
CD 4.0 6.00 7.00 9.000 16.0
BRA 1.0 1.00 2.00 3.750 7.0
ED 2.0 5.00 8.00 9.750 14.0
FEL 0.0 4.00 7.00 11.000 50.0
C 8.0 11.25 15.00 18.000 50.0
BW 2.0 4.00 5.65 8.175 17.6
BT 1.4 3.05 3.85 4.775 7.7
FEW 0.0 1.90 2.50 3.900 8.6
Coils 3.0 4.00 6.00 6.000 22.0
Length26.0 41.75 49.50 59.750128.0
In [33]:
data(EndScrapers)
xtabs(Freq~Site+Curvature, EndScrapers)
xtabs(Freq~Curvature+Sides+Site, EndScrapers)
             Curvature
Site          Round Medium Shallow
  Castenet A    388    504     306
  Ferrassie H   276    769     757
, , Site = Castenet A

         Sides
Curvature Convergent Parallel
  Round           89      299
  Medium          46      458
  Shallow         28      278

, , Site = Ferrassie H

         Sides
Curvature Convergent Parallel
  Round           21      255
  Medium          61      708
  Shallow         59      698
In [49]:
data(Olorgesailie.maj)
Olorgesailie.maj
# Compute percentages over the localities
Olor.pct <- prop.table(as.matrix(Olorgesailie.maj), 1)*100
boxplot(Olor.pct)
Large.cutting.toolsHeavy.duty.toolsLarge.scrapersOther.large.toolsSmall.toolsSpheroids
LS1 1 1 0 0 590
LS2 13 9 0 2 422
LS3 6 7 1 6 340
LS4 0 0 0 0 01
LS5 3314 6 24 1393
MS1a 5111 5 6 1241
MS1b 34 1 3 5 70
MS2a 69 7 4 5 108
MS2b43530 38 20 508
MS3 24 5 3 2 412
MS4 52 4 1 5 151
MS5 57 5 12 25 1084
MS6 14 1 2 0 130
MS7 89 5 5 4 45
MS8 97 4 6 7 330
MS9 2 3 0 4 130
US1 51 4 7 8 743
US2 7 2 0 6 471
US3 0 2 1 0 160
In [57]:
data(Olorgesailie.sub)
In [58]:
Olorgesailie.sub
StratLocalityHAPHACHACLKNBLCTPATCHCSLFSCBOLTSSSSSNPOSTSP
L1Lower BBB 0 0 0 1 0 0 1 0 0 0 0 0 34 24 1 0
L2Lower BBA 0 3 3 3 0 4 0 4 5 0 2 0 22 17 3 2
L3Lower FB 0 3 1 1 0 1 0 6 1 1 5 1 13 20 1 1
L4Lower FB/HL 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
L5Lower I3 6 17 3 5 2 0 4 9 1 6 20 4 110 29 0 3
M1aMiddle DE/89A-L1 36 0 1 4 9 2 7 2 5 4 2 78 45 1 1
M1bMiddle DE/89A-I2 20 0 1 2 9 1 0 0 3 1 4 7 0 0 0
M2aMiddle DE/89B-L1 27 0 34 1 6 1 6 0 4 2 3 6 1 3 8
M2bMiddle DE/89B-I2 245 0 148 33 7 9 18 3 38 0 20 29 21 0 8
M3Middle DE/89C 3 9 2 6 0 4 1 4 0 3 1 1 22 19 0 2
M4Middle H/6 7 21 10 4 6 4 1 3 0 1 2 3 10 4 1 1
M5Middle H/9-A 0 15 11 18 4 9 0 3 2 12 9 16 85 23 0 4
M6Middle H/9-AM 2 5 5 2 0 0 1 0 0 2 0 0 12 1 0 0
M7Middle Mid 3 27 15 34 4 6 1 4 0 5 0 4 1 1 2 5
M8Middle Meng 2 46 29 7 1 12 1 3 0 6 6 1 24 9 0 0
M9Middle LHS 0 1 0 0 0 1 1 2 0 0 1 3 8 5 0 0
U1Upper TrTr/M100 22 3 19 1 6 1 2 1 7 4 4 58 15 1 3
U2Upper Hog 1 2 1 1 0 3 0 2 0 0 1 5 34 13 0 1
U3Upper MFS 0 0 0 1 0 0 0 2 0 1 0 0 5 9 2 0
In [68]:
chisq.test(Olorgesailie.sub[,3:18], simulate.p.value=TRUE)
	Pearson's Chi-squared test with simulated p-value (based on 2000
	replicates)

data:  Olorgesailie.sub[, 3:18]
X-squared = 1717.1, df = NA, p-value = 0.0004998

Import your own data

In the following example, we have uploaded a file to the 'data-import' folder. It is a simple csv containing the data concerning the XRF measurements of the British School at Rome's collection of stamped brick Graham 2006. Try visualizing this data or re-running Graham's analysis.

In [ ]:
BSR_XRF <- read.csv(file="./data-import/xrd-majors-bsr-brickstamps.csv", header=TRUE, sep=",")
In [25]:
BSR_XRF
SampleQuartzAugiteHaematiteGehleniteCalciteAnalcimeMuscoviteDolomiteAnorthoclaseSanidineAlbite
se 1 58 70 14 0 0 10 34 36 105 0 0
se 2 16 83 5 0 43 9 0 23 0 0 66
se 4 89 36 17 36 70 0 7 14 0 55 61
se 5 42 94 8 0 0 0 10 40 0 65 55
se 7 20 102 9 0 0 15 10 30 85 25 0
se 8 50 14 10 20 75 0 10 0 56 0 0
se 10 50 60 16 20 0 0 42 48 0 50 45
se 13 87 25 24 30 55 19 14 13 56 0 0
se 14 32 104 9 3 0 20 10 40 85 0 0
se 14 38 106 12 0 5 17 15 47 0 60 65
se 16 86 28 14 50 86 25 26 22 103 0 0
se 18 38 71 17 0 32 0 3 28 95 0 0
se 19 38 92 9 0 50 0 0 30 0 0 100
se 20106 41 23 23 32 16 0 24 96 0 0
se 21 23 100 7 0 0 0 11 34 0 105 0
se 22 36 106 6 40 0 7 42 0 72 0 0
se 23 26 0 3 0 124 0 12 0 0 0 12
se 26 68 33 8 18 0 24 0 23 70 0 0
se 27 45 93 17 0 32 0 3 40 0 0 75
se 28 76 44 14 33 66 14 6 0 65 0 0
se 29 21 95 8 7 95 0 7 32 0 50 60
se 30 82 44 12 6 0 0 6 17 0 35 0
se 36 52 90 8 0 43 0 0 39 95 0 0
se 37 97 48 24 33 12 22 24 20 95 0 0
se 42 56 105 11 0 0 17 0 40 0 114 90
se 45 29 92 10 0 0 0 5 31 55 0 0
se 47 47 110 11 0 0 20 0 40 0 88 96
se 48 41 16 7 7 80 0 8 12 0 30 35
se 50 88 22 12 17 0 14 17 0 0 50 50
se 51 40 110 8 0 10 15 10 42 84 0 88
se 168117 85 18 60 10 25 22 21 100 0 0
se 170 33 23 31 0 11 0 0 12 0 0 117
se 171 63 26 13 46 100 13 15 0 25 0 70
se 172107 45 31 0 0 0 0 16 76 0 103
se 174 30 29 34 0 0 0 11 0 0 0 109
se 176 33 55 7 2 14 0 0 10 0 30 85
se 177 65 36 10 13 74 0 0 10 0 35 70
fal 1 105 0 10 60 30 26 33 0 90 0 0
fal 2 28 63 0 6 120 36 0 24 66 0 0
fal 3 92 54 20 90 76 20 9 0 85 0 0
fnv13 43 87 7 30 60 15 0 0 42 0 60
fnv14 92 91 13 0 110 9 0 32 70 0 0
fnv15 76 25 20 0 100 16 0 0 24 0 0
fnv4 64 25 6 0 72 0 9 3 0 0 27
fnv5 52 0 0 0 94 0 14 4 30 0 0
fnv6 72 22 10 0 75 0 16 0 23 0 0
fnv8 36 108 7 0 63 50 0 35 0 0 55
fnv9 14 98 6 0 72 8 7 23 0 0 77
mod 1 113 55 0 54 0 15 9 0 98 0 0
mod 2 37 120 7 43 0 10 0 27 24 0 0
mod 3 112 22 24 71 96 12 17 0 62 0 0
mod 4 16 0 0 5 127 0 0 0 0 5 0
mod 5 52 96 10 49 0 9 0 27 53 0 0
mod 6 57 105 6 60 0 6 0 20 36 0 0
mod 7 37 0 0 38 124 0 16 0 0 0 25
mod 8 105 0 0 20 100 20 20 0 32 0 0
mod 9 11 0 3 0 54 0 3 4 0 0 3
ser 1 89 38 9 12 79 0 12 28 0 0 70
ser 2 97 18 14 8 60 0 18 7 0 36 50
ser 3 90 46 10 6 90 0 19 19 45 35 0
In [28]:
BSR.pca <- prcomp(BSR_XRF[, -1], scale.=TRUE)
biplot(BSR.pca, xlabs=abbreviate(BSR_XRF$Sample, 1), cex=.75)
In [ ]: