Learn R Programming

maxent.ot (version 1.0.0)

otsoft_tableaux_to_df: Converts an OTSoft tableaux file to a data frame

Description

Loads an OTSoft tableaux file and converts it to the data frame format used by the maxent.ot functions.

Usage

otsoft_tableaux_to_df(input, output_path = NA, encoding = "unknown")

Value

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.

Arguments

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".

Examples

Run this code
  # 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)

Run the code above in your browser using DataLab