View source: R/ps_createData.r
ps_createData | R Documentation |
Create data frame with data to be analyzed, columns in specified order
ps_createData(doc = "ps_createData", data, Group, Subset, ID, AnalyticVars)
doc |
Documentation, default is the function name |
data |
Data frame containing the data for one group |
Group |
Character: user-specified grouping code for these data, added to the data set |
Subset |
Character: name of variable with codes for subsets of samples, " " if no subsets |
ID |
Character: name of IDs (typically lab IDs) for samples |
AnalyticVars |
Character vector with names for elements used from the data |
A list with the elements:
usage: Documentatation, including function name, version of R used, date run)
dataUsed: Data used, restricted to the specified group
analyticVars: The value of AnalyticVars
dataOut: The data frame created by the function, with Group, Subset (if specified), ID, and analytic variables
This function creates a data frame with columns in a specified order. It is useful for combining multiple data frames into one analysis object using rbind(). The name for a specified variable must be the same in each file used in the argument data; a space after a variable name in an excel file imported into R yields the variable name followed by a period.
# create example data set by restricting to one group, removing column with group code,
# then adding that code back to the data set
data(ObsidianSources)
ps_createData(data = ObsidianSources[(ObsidianSources[,"Code"] == "A"),][,-1],
Group = "A",
Subset = " ",
ID = "ID",
AnalyticVars = c("Rb","Sr","Y","Zr","Nb"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.