ps_boxPlots
ps_boxPlots.Rd
Box plots of specified analytic values, by specified groups.
Arguments
- doc
A string documenting use, included in list returned; default value is the function name
- data
A data frame or matrix with data to be analyzed
- GroupVar
The name for the variable defining grouping (required)
- Groups
A vector of values of group variable for which plots are to be done; if 'All', use all groups: if ' ', no grouping
- AnalyticVars
A vector of names (character values) of analytic results to be analyzed
- Nrow
The number of rows of plots for each page
- Ncol
The number of columns of plots for each page
Value
A list with the following components:
usage: A string with the value of the argument doc, date run, version of R used
dataUsed: A data frame with data restricted to data used for the box plots
dataNA: A data frame with observations containing a least one missing value for an analysis variable, NA if no missing values
params: A list with elements containing the values of the grouping and numeric parameters
analyticVars: A vector with the value of the argument AnalyticVars
DETAILS
If the function creates more than one plot, the code stops after each is displayed; enter c (continue) at the prompt to display the next plot. If Groups specifies only one group, the code for that group is not displayed under a plot. If an observation has a variable value that is missing, the variables without missing values are used in the corresponding box plots.
Examples
data(ObsidianSources)
boxPlots<-ps_boxPlots(data=ObsidianSources, GroupVar="Code", Groups="All",
AnalyticVars=c("Rb","Nb", "Zr","Sr"),Nrow=2,Ncol=2)
#> Warning: some notches went outside hinges ('box'): maybe set notch=FALSE
#> Warning: some notches went outside hinges ('box'): maybe set notch=FALSE
#> Warning: some notches went outside hinges ('box'): maybe set notch=FALSE
#> Warning: some notches went outside hinges ('box'): maybe set notch=FALSE
# side-by-side box plots of each source and artifacts assigned to that source
data(ObsidianSources)
data(ObsidianArtifacts)
analyticVars<-c("Rb","Sr","Y","Zr","Nb")
ObsidianSources<-ObsidianSources[,c("Code",analyticVars)]
Artifacts <- ObsidianArtifacts[,c("Code",analyticVars)]
SourcesCode <- as.vector(ObsidianSources[,"Code"], mode="character")
ArtifactsCode <- as.vector(paste(Artifacts[,"Code"],"A",sep="_"),mode="character")
Codes <- c(SourcesCode, ArtifactsCode)
SourcesArtifacts <- data.frame(rbind(ObsidianSources,Artifacts)[,analyticVars], Code = Codes)
boxPlots<-ps_boxPlots(data=SourcesArtifacts, GroupVar="Code", Groups="All",
AnalyticVars="Rb",Nrow=1,Ncol=1)
#> Warning: some notches went outside hinges ('box'): maybe set notch=FALSE