as_checkData: as_CheckData

View source: R/as_checkData.R

as_checkDataR Documentation

as_CheckData

Description

Data checks and summaries: duplicate records, negative analytic values, numbers of analytic results, percentiles of results

Usage

as_checkData(
  doc = "as_CheckData",
  data,
  CheckDupVars,
  GroupVar = " ",
  Groups,
  ID = " ",
  AnalyticVars,
  folder = " "
)

Arguments

doc

a character string written to the output list; default is the function name

data

R object (data frame) containing analytic data

CheckDupVars

vector with names of identifying variables, typically group and lab ID

GroupVar

if there are groups, name of variable defining the groups, default value of " ": no grouping

Groups

character vector of groups by which numbers of samples and statistics statistics will be tabulated default value of " ": tabulations are done for the entire data set value = "All": tabulation for each distinct code in GroupVar

ID

name of lab ID, default is " " (no lab ID)

AnalyticVars

character vector of names of analytic variables for which tabulations are done

folder

the path to a folder in which data frames will be saved; default is " " #“

Value

Four data frames with duplicate observations, observations with negative values for one or more analytic variables, numbers of observations for each analytic variable, and statistics statistics (quartiles and number missing) if Groups != " ", numbers of observations and statistics statistics are by group A list with the following components:

  • usage: A string with the contents of the argument doc, date run, R version used

  • dataUsed: The data frame specified by the argument data and GroupVar|

  • params: A character vector with the values of CheckDupVars, GroupVar, and Groups

  • analyticVars: The vector of names specified by the argument AnalyticVars

  • Duplicates: A data frame containing the observations with duplicate values

  • NegativeValues: A data frame containing the observations with at least one negative value for a variable in AnalyticVars

  • Nvalues: A data frame contain the number of observations with a value for each analytic variable

  • statistics: A data frame containing the statistics statistics (by group, if Group is specified)

  • location: If folder != " ", the path to the folder in which data frames will be saved

Detail

AnalyticVars must be a vector of length at least 2. If Groups specifies selected groups (is not equal to "All" or " "), if must be a vector of length at least 2.

Examples

data(ObsidianSources)
analyticVars<-c("Rb","Sr","Y","Zr","Nb")
dataCheck<-as_checkData(data=ObsidianSources,CheckDupVars=analyticVars,GroupVar="Code",Groups="All",
ID = "ID", AnalyticVars=analyticVars)


benmarwick/karon documentation built on July 29, 2023, 10:11 a.m.