Learn R Programming

glossr (version 0.8.0)

as_gloss: Helper to create gloss objects

Description

Based on a character vectors and up to three label arguments, create an object where those arguments are attributes. These are:

  • source: Where the text comes from. This will be printed in the first line of the example, without word alignment.

  • translation: Free translation. This will be printed as the last line of the example, without word alignment and in quotation marks if so desired.

  • label: Named label of the example, for cross-references.

  • lengths: This is computed within the function, not provider, and it's the number of items identified in each gloss line.

Usage

as_gloss(
  ...,
  source = NULL,
  translation = NULL,
  label = NULL,
  trans_quotes = config$trans_quotes,
  output_format = config$output,
  numbering = config$numbering
)

Value

Object of class gloss, ready to be printed based on the chosen output format, and with a gloss_data object as data attribute (or, in the case of calls via gloss_df(), the original input asdata).

Arguments

...

Lines for glossing

source

(Optional) Source of example

translation

(Optional) Free translation

label

(Optional) Example label

trans_quotes

(Optional) Quotes to surround the free translation with.

output_format

(Optional) Whether it will use latex, word or html format.

numbering

(Optional) Whether the gloss should be numbered (in Word and HTML).

Examples

Run this code
ex_sp <- "Un ejemplo en español"
ex_gloss <- "DET.M.SG example in Spanish"
ex_trans <- "An example in Spanish"
my_gloss <- as_gloss(ex_sp, ex_gloss, translation = ex_trans, label="ex1")

# check the gloss data
attr(my_gloss, "data")

Run the code above in your browser using DataLab