Type: Package
Title: Read 'ELAN' Files
Version: 0.1.0
Description: The goal of the 'readelan' is to provide a simple way to read data and metadata in files created with the annotation software 'ELAN' https://archive.mpi.nl/tla/elan into R as data frames.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: tools, utils, xml2
URL: https://github.com/borstell/readelan
BugReports: https://github.com/borstell/readelan/issues
NeedsCompilation: no
Packaged: 2026-04-01 17:33:24 UTC; carlborstell
Author: Carl Börstell ORCID iD [aut, cre, cph]
Maintainer: Carl Börstell <carl.borstell@uib.no>
Repository: CRAN
Date/Publication: 2026-04-07 08:00:02 UTC

Read controlled vocabularies (CV) in EAF/ETF file(s)

Description

Reads the controlled vocabularies in ELAN (.eaf/.etf/.ecv) file(s) from a single file or a vector of files as input.

Usage

read_cv(file, full_path = FALSE, ecv = TRUE, progress = FALSE)

Arguments

file

Path(s) to ELAN file(s) (.eaf/.etf/.ecv)

full_path

Whether file names should include full path (defaults to 'FALSE')

ecv

Whether to read linked external CVs as well (defaults to 'TRUE')

progress

Whether to display a progress bar (defaults to 'FALSE')

Details

If 'full_path' is set to 'FALSE' (default), the input file names will be listed with their base names only, without the full path.

If 'progress' is set to 'TRUE' (defaults to 'FALSE'), a progress bar is printed to the console to show the iteration across input files.

Value

Data frame of the ELAN media metadata

Examples

eaf_file <- system.file("extdata", "example.eaf", package = "readelan", mustWork = TRUE)
read_cv(eaf_file, ecv = FALSE)

# External CVs (.ecv files) can also be read
ecv_file <- system.file("extdata", "syntax.ecv", package = "readelan", mustWork = TRUE)
read_cv(ecv_file, ecv = FALSE)


Read annotations in EAF file(s)

Description

Reads the annotations in ELAN annotation file(s) (.eaf) from a single file or a vector of files as input.

Usage

read_eaf(
  file,
  tiers,
  xpath,
  fill_times = TRUE,
  full_path = FALSE,
  progress = FALSE
)

Arguments

file

Path(s) to ELAN annotation file(s) (.eaf)

tiers

Specify tiers (TIER_ID or TIER_TYPE) to be read

xpath

Specify a detailed XPath for tiers to be read

fill_times

Fill empty time slots of child annotations (defaults to 'TRUE')

full_path

Whether file names should include full path (defaults to 'FALSE')

progress

Whether to display a progress bar (defaults to 'FALSE')

Details

Specific tiers or tier types can be targeted with a named list, 'tiers = list(tier = "tier1", tier_type = c("tier_type1", "tier_type2"))', or a custom XPath input, ‘xpath = ".//TIER[starts-with(@TIER_ID,’gloss')]"'. A valid 'tier' input will override any simultaneous 'xpath' input.

If 'fill_times' is set to 'TRUE' (default), the time slots of child annotations will be filled with the values of their parent annotations.

If 'full_path' is set to 'FALSE' (default), the input file names will be listed with their base names only, without the full path.

If 'progress' is set to 'TRUE' (defaults to 'FALSE'), a progress bar is printed to the console to show the iteration across input files.

Value

Data frame of ELAN annotations

Examples

eaf_file <- system.file("extdata", "example.eaf", package = "readelan", mustWork = TRUE)
read_eaf(eaf_file)


Read media metadata in EAF file(s)

Description

Reads the media metadata in ELAN (.eaf) file(s) from a single file or a vector of files as input.

Usage

read_media(file, full_path = FALSE, progress = FALSE)

Arguments

file

Path(s) to ELAN annotation file(s) (.eaf)

full_path

Whether file names should include full path (defaults to 'FALSE')

progress

Whether to display a progress bar (defaults to 'FALSE')

Details

If 'full_path' is set to 'FALSE' (default), the input file names will be listed with their base names only, without the full path.

If 'progress' is set to 'TRUE' (defaults to 'FALSE'), a progress bar is printed to the console to show the iteration across input files.

Value

Data frame of ELAN media metadata

Examples

eaf_file <- system.file("extdata", "example.eaf", package = "readelan", mustWork = TRUE)
read_media(eaf_file)


Read tier metadata in in EAF/ETF/ECV file(s)

Description

Reads the tier metadata in ELAN file(s) (.eaf/.etf/.ecv) from a single file or a vector of files as input.

Usage

read_tiers(file, full_path = FALSE, progress = FALSE)

Arguments

file

Path(s) to ELAN file(s) (.eaf/.etf/.ecv)

full_path

Whether file names should include full path (defaults to 'FALSE')

progress

Whether to display a progress bar (defaults to 'FALSE')

Details

If 'full_path' is set to 'FALSE' (default), the input file names will be listed with their base names only, without the full path.

If 'progress' is set to 'TRUE' (defaults to 'FALSE'), a progress bar is printed to the console to show the iteration across input files.

Value

Data frame of ELAN tier metadata

Examples

eaf_file <- system.file("extdata", "example.eaf", package = "readelan", mustWork = TRUE)
read_tiers(eaf_file)

etf_file <- system.file("extdata", "CLP_annotation_v2-2.etf", package = "readelan", mustWork = TRUE)
read_tiers(etf_file)