import-datavyur: Imports Datavyu content into R

Description Usage Arguments Details Value Functions Note import_datavyu import_datavyu_to_list Examples

Description

The function will find data exported from .opf to .csv using the built-in Ruby script.

Usage

1
2
3
4
5
6
7
8
9
import_datavyu(..., as_list = FALSE, append_colnames = FALSE)

import_datavyu_to_list(
  folder = getOption("datavyur.folder"),
  columns = NULL,
  files = NULL,
  class_overwrite = getOption("datavyur.classlist"),
  traverse = FALSE
)

Arguments

...

Additional arguments passed to import_datavyu_to_list().

as_list

A logical value indicating to return a list or data frame (default).

append_colnames

If TRUE, the column names for the returned data will be in column.field format, e.g., childhands.ordinal, instead of having the Datavyu column name in its own variable in the returned data set.

folder

Either a scalar character pointing to a directory where contents are to be scanned, or a vector of .csv files to import instead of all the contents found within a folder. Defaults to the R option datavyur.folder, which is the internal example data folder that is used throughout this package. If folder is a character vector of multiple .csv file paths, set as_list=TRUE.

columns

Similar to the files argument. The name of the Datavyu "column" to import, as used in the original datavyu .opf file.

files

The short name of the Datavyu "file" to import, as used for the original datavyu .opf file name. For example, a Datavyu file dyad1.opf, when exported using datavyu2csv.rb, will have in the .csv file dyad1 as the value in the column "file", and if files="dyad1" is specified for a function, only data from dyad1.opf will be imported even though they may be separated as multiple .csv files in a folder.

class_overwrite

A list of new classes to override the guessed classes when reading in .csv data. See colClasses from data.table::fread(). Sometimes fread doesn't get the class of the imported column right. This can happen if you have "codes" in your data that can be several possible types. Use class_overwrite to override improper type settings.

traverse

Search subfolders of folder for datavyur .csv files.

Details

Most functions in this package only work if you had previously used the datavyu2csv.rb script to export a Datavyu file to .csv. This script can be obtained from ruby_script_folder(). Exported data is in the form of several "/column__file.csv" files. Files will be searched based on the directory supplied to the folder argument. Valid files will have the following columns: file, column, onset, offset, ordinal, along with custom user codes as columns.

Value

See sections import_datavyu and import_datavyu_to_list below.

Functions

Note

If the same column name was used across separate .opf files but has a different set of datavyu codes then you will get an error unless as_list=TRUE.

import_datavyu

Returns one of the objects below.

import_datavyu_to_list

Returns a list with the names:

Examples

1
2
3
4
5
6
7
8
9
import_datavyu(columns="childhands")
import_datavyu(columns="childhands", append_colnames=TRUE)
import_datavyu(columns=c("childhands", "parenthands"), as_list=TRUE)

example_data_info <- datavyu_search(folder=datavyur_internal_data())
import_datavyu(files=example_data_info$file[1])

data_list <- import_datavyu_to_list()
str(data_list)

iamamutt/datavyur documentation built on Dec. 20, 2021, 5:57 p.m.