View source: R/export_for_analysis.R
save_for_interact | R Documentation |
Save a dictionary or equation data frame in a text file format that can be copied and pasted into the Java version of Interact for analysis using that program. This allows users to create desired data subsets using this package rather than manually adding and removing lines from datasets Interact provides, facilitating more reproducible workflows using Interact Java. This may also help users reformat their own imported datasets for use in Interact.
save_for_interact(
data,
type = "dict",
group = "none",
filename = paste0(deparse(substitute(data)), ".txt"),
savefile = TRUE
)
data |
data frame to save |
type |
string ("dict" or "eqn") indicating type of data |
group |
string indicating the name or numeric index of a column to group on. This column must contain only two values and each term must have one entry for each |
filename |
string. the filepath at which to save (must end in .txt) |
savefile |
logical. that denotes whether to actually save the file (FALSE is primarily useful for testing purposes). Default is TRUE. |
Provided data must contain a column titled "term" and either three or six
numeric columns with EPA values that start with "E", "P", and "A". These requirements
are generally satisfied by dataframes produced by epa_subset()
.
If three numeric columns are provided, the function can accept an optional "group" argument that is the name of a column that contains two values. This column will be used to "widen" the data to two sets of EPA columns. The first set will correspond with the first value in the group column and the second set will correspond with the second value. This is useful when you wish to allow Interact to take two different sets of values depending on which of two groups an actor is a part of. This is most frequently used to provide gendered data, but it has other applications as well–for example, if you wish to allow students and teachers to have different meanings for the same terms.
Note that Interact requires identity, behavior, setting, and modifier data to be loaded separately, meaning that prior to using this function, users should ensure that only one component is represented per file.
the dataframe that is written to file
## Not run:
save_for_interact(data = epa_subset(dataset = "household1997", component = "behavior"),
filename = "household1997behavior.txt")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.