otsoft_tableaux_to_df | R Documentation |
Loads an OTSoft tableaux file and converts it to the data frame format used by the maxent.ot functions.
otsoft_tableaux_to_df(input, output_path = NA, encoding = "unknown")
input |
The path to the input data file. This should contain more OT tableaux consisting of mappings between underlying and surface forms with observed frequency and violation profiles. Constraint violations must be numeric. The file should be in OTSoft format. For examples of OTSoft format, see inst/extdata/sample_data_file.txt. |
output_path |
(optional) A string specifying the path to a file to which the data frame will be saved in CSV format. If the file exists it will be overwritten. If this argument isn't provided, the output will not be written to a file. |
encoding |
(optional) The character encoding of the input file. Defaults to "unknown". |
A data frame corresponding to the input OTSoft tableau, containing the columns
Input
: The input form.
Output
: The output form.
Frequency
: The frequency of the input/output mapping.
One column for each constraint containing its violation counts.
# Convert OTSoft file to data frame format
otsoft_file <- system.file(
"extdata", "sample_data_file_otsoft.txt", package = "maxent.ot"
)
df_output <- otsoft_tableaux_to_df(otsoft_file)
# Save data frame to a file
tmp_output <- tempfile()
otsoft_tableaux_to_df(otsoft_file, tmp_output)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.