proctor_datasheet: Generate a table to hold raw data in compaction tests.

View source: R/proctor_datasheet.R

proctor_datasheetR Documentation

Generate a table to hold raw data in compaction tests.

Description

Generating a skeleton file permits a consistent data structure to be maintained over time. It also eliminates the need to manually create a file via Excel or another GUI, which is a nuisance and allows errors via copy-paste or typos. The user may simply specify a directory and the file is automatically written to disk with a sensible name( ~/<directory>/<date>_<proctor_raw_data>). Alternatively, a custom file name can be specified.

Usage

proctor_datasheet(
  prep_sheet = NULL,
  date = NULL,
  tin_tare_set = NULL,
  tin_numbers = NULL,
  ambient_temp_c = 20,
  write = TRUE,
  directory = NULL,
  path = "auto"
)

Arguments

prep_sheet

A data frame. It is recommended to pipe this argument directly from proctor_prep(). Must be of class proctor_prep_sheet. Includes sample metadata such as test date, mix names, efforts, etc. @param date Date of compaction test. If NULL (the default), inherits date from prep_sheet argument.

tin_tare_set

Character string (length 1) which identifies the set of tin tare measurements to use during subsequent data analyses. If NULL (the default), an empty string is used.

tin_numbers

Numeric. Length must equal total number of experimental units in prep_sheet. If NULL (the default), an empty string is used.

ambient_temp_c

Ambient temperature during the test in °C. Used to compute water density during data analysis (see add_physical_properties()). Defaults to 20°C for filling data sheet; user should measure temperature during test and input before data collection. Be careful to record only one value during the test or add_physical_properties() will fail.

write

Defaults to TRUE and saves empty data sheet as a .csv file. Will not over-write an existing file.

directory

Directory in which to save the file.

path

If "auto", constructs a file name from the date column of prep_sheet and the directory argument; otherwise specify a path to save the file (including relative directory)

Details

[Experimental]

Value

A tibble of relevant data. Also writes file to disk when write = TRUE.

Examples

# prepare reference sheet for wetting samples from existing water contents and
# estimated w_opt values (these should be estimated visually and confirmed with
# water content measurements, but are simply typed here for demonstration)
library(tibble)
library(dplyr)
library(tidyr)

w_extant_values <- tibble(
  sample_name = paste0("mix_0", 1:3),
  w_extant = c(0.048, 0.057, 0.062))

PL_values <- tibble(
  sample_name = paste0("mix_0", 1:3),
  PL= c(0.095, 0.10, 0.14),
  standard = 0.9*PL,
  modified= standard - 0.03)

prep_sheet <- w_extant_values %>%
  left_join(PL_values) %>%
  select(-PL) %>%
  pivot_longer(cols= c(standard:modified),
               names_to =  'effort',
               values_to = 'est_w_opt')%>%
  select(sample_name, effort, everything()) %>%
  arrange(desc(effort)) %>%
  proctor_prep(date = Sys.Date())

# write file to disk
proctor_datasheet(prep_sheet, dir= paste0(tempdir(), "/") )

# alternatively, return the data sheet as a tibble
proctor_datasheet(prep_sheet, write = FALSE)


evanmascitti/soiltestr documentation built on Oct. 6, 2022, 5:32 p.m.