import_chron {chronochrt}R Documentation

Import data for Chronological chart

Description

The function imports and converts chronological information from tabular data saved as .csv, .xlsx and .xls, and any other kind of delimited file format into a ready-to-use data set for plotting with ChronochRt. It automatically selects the appropriate import function from the file extension and the argument delim. To import excel files, the package readxl must be installed.

Usage

import_chron(
  path,
  region = "region",
  name = "name",
  start = "start",
  end = "end",
  level = "level",
  add = "add",
  delim,
  ...
)

Arguments

path

A character string with either the path or a URL to the file to be imported.

region

Character string (case sensitive) with the column name of the region/section, default to "region".

name

Character string (case sensitive) with the column name of the chronological units' names, default to "name".

start

Character string (case sensitive) with the column name of the chronological units' start dates, default to "start".

end

Character string (case sensitive) with the column name of the chronological units' end dates, default to "end".

level

Character string (case sensitive) with the column name of the chronological units' levels, default to "level".

add

Character string (case sensitive) with the column name of the information whether the chronological units within a region/section should be drawn separately or not, default to "add".

delim

A character string with the separator for tabular data. Use delim = "\t" for tab-separated data. Must be provided for all file types except .xlsx or .xls.

...

Additional arguments passed to the respective import functions. See their documentation for details:

Details

Additional columns in the import file will be imported as they are. Among these might be e.g. columns specifying the x and y position of the names to place them at an arbitrary spot.

Value

A tibble containing the desired chronological information.

Examples

## Not run: 

# Import of Excel files
chrons <- import_chron(path = "ex_urnfield_periods.xlsx",
                       region = "Region",
                       name = "Name",
                       start = "Start",
                       end = "End",
                       level = "Level",
                       add = "Add")

# Import of delimited tabular data
chrons <- import_chron(path = "ex_urnfield_periods.csv",
                       region = "Region",
                       name = "Name",
                       start = "Start",
                       end = "End",
                       add = "Add",
                       delim = ",")

chrons <- import_chron(path = "ex_urnfield_periods.txt",
                       region = "Region",
                       name = "Name",
                       start = "Start",
                       end = "End",
                       add = "Add",
                       delim = "\t")

# Include additional parameters of the import function
chrons <- import_chron(path = "ex_urnfield_periods.xlsx",
                       region = "Region",
                       name = "Name",
                       start = "Start",
                       end = "End",
                       level = "Level",
                       add = "Add",
                       sheet = "data")

## End(Not run)

[Package chronochrt version 0.1.3 Index]