Note: If you wish to replicate the R code below, then you will need to copy and paste the following commands in R first to make sure you have all the packages and their dependencies installed:
install.packages(c("install.load", "import", "ggplot2", "data.table", "pander", "units",
"remotes"))
# install the packages and their dependencies
# As geotech is currently archived,
remotes::install_version("geotech", version = "1.0")
# Source 1
Note: If you wish to replicate the R code below, then you will need to copy and paste the following commands in R first to make sure you have all the packages loaded:
install.load::load_package("geotech", "ggplot2", "data.table", "pander", "units")
# load needed packages using the load_package function from the install.load
# package (it is assumed that you have already installed these packages)
import::from(pracma, semilogx, std)
# import semilogx and std from the pracma package
panderOptions("missing", "")
# set pander options to have missing values in the tables as blank cells
# Example 1 from Fall 2014 Group 1
# create a numeric vector with the units of inch
value_in <- set_units(3/8, "in")
# create a numeric vector to convert from inch to centimeter
value_mm <- value_in
# create a numeric vector with the units of millimeter
units(value_mm) <- make_units(mm)
# make numeric
value_mmnum <- drop_units(value_mm)
sand_grad_1a <- data.table(Sieve = c("3/8ā", "4", "8", "16", "30", "50", "Pan"),
Size = c(value_mmnum, 4.75, 2.36, 1.18, 0.6, 0.3, NA), Mass_Sieve = c(0.516,
0.734, 0.46, 0.408, 0.39, 0.344, 0.362), Mass_SievePlus = c(0.516, 0.766,
0.566, 0.532, 0.618, 0.76, 0.45))
sand_grad_1a <- sand_grad_1a[, V2 := Mass_SievePlus - Mass_Sieve]
sand_grad_1a <- sand_grad_1a[, V3 := cumsum(V2)]
sand_grad_1a <- sand_grad_1a[, V4 := round(V3/sum(V2) * 100, digits = 0)]
sand_grad_1a <- sand_grad_1a[, V5 := round(100 - V4, digits = 0)]
set(sand_grad_1a, i = 7L, j = c(5L:8L), value = NA)
setnames(sand_grad_1a, c("Sieve #", "Size (mm)", "Mass Sieve (kg)", "Mass Retained + Sieve (kg)",
"Mass Retained (kg)", "Cumulative Mass Retained (kg)", "Cumulative % Retained",
"% Passing"))
sand_grad_1a <- setDF(sand_grad_1a)
sand_grad_1a[, 7:8] <- round(sand_grad_1a[, 7:8], digits = 3)
pander(sand_grad_1a, caption = "Fall 2014 Group 1 Sieve Analysis Table", round = c(c(2,
2), c(3, 3), c(4, 3), c(5, 3), c(6, 3)))| Sieve # | Size (mm) | Mass Sieve (kg) | Mass Retained + Sieve (kg) |
|---|---|---|---|
| 3/8ā | 9.53 | 0.516 | 0.516 |
| 4 | 4.75 | 0.734 | 0.766 |
| 8 | 2.36 | 0.46 | 0.566 |
| 16 | 1.18 | 0.408 | 0.532 |
| 30 | 0.6 | 0.39 | 0.618 |
| 50 | 0.3 | 0.344 | 0.76 |
| Pan | 0.362 | 0.45 |
Fall 2014 Group 1 Sieve Analysis Table (continued below)
| Mass Retained (kg) | Cumulative Mass Retained (kg) | Cumulative % Retained |
|---|---|---|
| 0 | 0 | 0 |
| 0.032 | 0.032 | 3 |
| 0.106 | 0.138 | 14 |
| 0.124 | 0.262 | 26 |
| 0.228 | 0.49 | 49 |
| 0.416 | 0.906 | 91 |
| % Passing |
|---|
| 100 |
| 97 |
| 86 |
| 74 |
| 51 |
| 9 |
# calculate the Fineness Modulus
FM_1a <- sum(sand_grad_1a[, 7], na.rm = TRUE)/100
FM_1a## [1] 1.83
op <- par(mar = c(5, 4, 8, 2)) # set margins
semilogx(sand_grad_1a[, 2], (sand_grad_1a[, 8] - 1L), xlab = "Sieve size (mm)", ylab = "% Passing",
type = "b", axes = FALSE, pch = 19, xlim = c(0.075, 50), ylim = c(0, 100))
x1 <- c(0.075, 0.15, 0.3, 0.6, 1.18, 2.36, 4.75, 9.5, 12.5, 19, 25, 37.5, 50)
x2 <- c("No. 200", "No. 100", "No. 50", "No. 30", "No. 16", "No. 8", "No. 4", "3/8 in.",
"1/2 in.", "3/4 in.", "1 in.", "1 1/2 in.", "2 in.")
y <- seq(0, 100, 10)
axis(1, at = x1, labels = NULL, tck = 0, las = 2)
axis(3, at = x1, labels = x2, tck = 0, las = 2)
abline(h = seq(0, 100, 5), v = x1)
axis(2, at = y, labels = y, tck = 0)
box() # Source 3
mtext("Sieve size", side = 3, line = 4, cex.lab = 0.8, las = 0)
mtext("Group 1 Sand Gradation Results (ASTM C136)", side = 3, line = 5, cex.lab = 0.8,
las = 0)par(op) # reset to previous settings
sieve <- c(3/8, 4, 8, 16, 30, 50)
# Modified Example 1 from the grainSize function of the geotech package Plot
# grain-size distribution
grainSize.plot(sieve = sieve, percent = (sand_grad_1a[(1:nrow(sand_grad_1a) - 1L),
8] - 1L), metric = TRUE)# Group 2
sand_grad_2a <- data.table(Sieve = c("3/8ā", "4", "8", "16", "30", "50", "Pan"),
Size = c(value_mmnum, 4.75, 2.36, 1.18, 0.6, 0.3, NA), Mass_Sieve = c(0.516,
0.508, 0.462, 0.406, 0.38, 0.348, 0.366), Mass_SievePlus = c(0.516, 0.538,
0.558, 0.522, 0.606, 0.77, 0.466))
sand_grad_2a <- sand_grad_2a[, V2 := Mass_SievePlus - Mass_Sieve]
sand_grad_2a <- sand_grad_2a[, V3 := cumsum(V2)]
sand_grad_2a <- sand_grad_2a[, V4 := round(V3/sum(V2) * 100, digits = 0)]
sand_grad_2a <- sand_grad_2a[, V5 := round(100 - V4, digits = 0)]
set(sand_grad_2a, i = 7L, j = c(5L:8L), value = NA)
setnames(sand_grad_2a, c("Sieve #", "Size (mm)", "Mass Sieve (kg)", "Mass Retained + Sieve (kg)",
"Mass Retained (kg)", "Cumulative Mass Retained (kg)", "Cumulative % Retained",
"% Passing"))
sand_grad_2a <- setDF(sand_grad_2a)
sand_grad_2a[, 7:8] <- round(sand_grad_2a[, 7:8], digits = 3)
pander(sand_grad_2a, caption = "Fall 2014 Group 2 Sieve Analysis Table", round = c(c(2,
2), c(3, 3), c(4, 3), c(5, 3), c(6, 3)))| Sieve # | Size (mm) | Mass Sieve (kg) | Mass Retained + Sieve (kg) |
|---|---|---|---|
| 3/8ā | 9.53 | 0.516 | 0.516 |
| 4 | 4.75 | 0.508 | 0.538 |
| 8 | 2.36 | 0.462 | 0.558 |
| 16 | 1.18 | 0.406 | 0.522 |
| 30 | 0.6 | 0.38 | 0.606 |
| 50 | 0.3 | 0.348 | 0.77 |
| Pan | 0.366 | 0.466 |
Fall 2014 Group 2 Sieve Analysis Table (continued below)
| Mass Retained (kg) | Cumulative Mass Retained (kg) | Cumulative % Retained |
|---|---|---|
| 0 | 0 | 0 |
| 0.03 | 0.03 | 3 |
| 0.096 | 0.126 | 13 |
| 0.116 | 0.242 | 24 |
| 0.226 | 0.468 | 47 |
| 0.422 | 0.89 | 90 |
| % Passing |
|---|
| 100 |
| 97 |
| 87 |
| 76 |
| 53 |
| 10 |
# calculate the Fineness Modulus
FM_2a <- sum(sand_grad_2a[, 7], na.rm = TRUE)/100
FM_2a## [1] 1.77
# mean, standard deviation, and variance of the Fineness Modulus (Group 1 and
# 2)
FM_2014 <- c(FM_1a, FM_2a)
mean(FM_2014)## [1] 1.8
std(FM_2014)## [1] 0.04242641
var(FM_2014)## [1] 0.0018
op <- par(mar = c(5, 4, 8, 2)) # set margins
semilogx(sand_grad_2a[, 2], sand_grad_2a[, 8], xlab = "Sieve size (mm)", ylab = "% Passing",
type = "b", axes = FALSE, pch = 19, xlim = c(0.075, 50), ylim = c(0, 100))
axis(1, at = x1, labels = NULL, tck = 0, las = 2)
axis(3, at = x1, labels = x2, tck = 0, las = 2)
axis(2, at = y, labels = y, tck = 0)
abline(h = seq(0, 100, 5), v = x1)
box() # Source 3
mtext("Sieve size", side = 3, line = 4, cex.lab = 0.8, las = 0)
mtext("Group 2 Sand Gradation Results (ASTM C136)", side = 3, line = 5, cex.lab = 0.8,
las = 0)