Package 'iker'

Title: Iker Is Your Data Scribe
Description: Iker defines itself as a Scribe - a person who copies out documents. The package is meant to read / write data and provide various connectors.
Authors: Philippe Peret [aut, cre, cph] (ORCID: <https://orcid.org/0009-0003-9666-7490>)
Maintainer: Philippe Peret <[email protected]>
License: GPL-3 + file LICENSE
Version: 0.9.5
Built: 2026-10-01 20:30:22 UTC
Source: https://github.com/thekangaroofactory/iker

Help Index


Convert POSIXct Columns to ISO-8601 Character

Description

Convert POSIXct Columns to ISO-8601 Character

Usage

from_POSIXct(data)

Arguments

data

a data.frame (expected to contain POSIXct columns)

Value

a data.frame, whose POSIXct columns have been converted to ISO-8601 character columns

Examples

from_POSIXct(data.frame(a = Sys.time()))

Load Data From Various Connectors

Description

Load Data From Various Connectors

Usage

load_data(..., verbose = FALSE, data.frame = FALSE, force_empty = FALSE)

Arguments

...

arguments to pass to connector (see details)

verbose

a logical (default = FALSE) to indicate if additional traces should be sent to the console

data.frame

a logical (default = FALSE) if a data.frame should be returned (instead of a tibble)

force_empty

a logical (default = FALSE) if NULL should be returned when data has no row

Details

The load_data function is a wrapper around connector functions. It offers a single point of access to the package data persistence features.

Arguments passed to ... depend on the desired connector:

Value

the output of the connector function

Examples

## Not run: 
# -- file connector
load_data(file = "my_data.csv", path = getwd())

## End(Not run)

Read Data

Description

Read Data

Usage

read_data(
  path = Sys.getenv("DATA_HOME"),
  resource = NULL,
  file,
  delim = ",",
  col_types = NULL,
  verbose = FALSE
)

Arguments

path

A path where to read the data (see details).

resource

An optional resource name (used as sub folder inside path).

file

The name of the file to read (with extension).

delim

Single character used to separate fields within a record.

col_types

See read_delim function from readr package.

verbose

A logical whether additional trace should be sent to the console.

Details

By default, path takes its value from the DATA_HOME environment variable. If it's not set in the environment and no value has been provided, function will be stopped (and return NULL). When NULL, it will be ignored (assuming file contains the full path to the file)

col_types will be used to detect if POSIXct columns are expected. In this case they will be read as character first (expecting an ISO-8601 compatible string) then converted to POSIXct.

Value

A tibble, output value of the read_delim() call or NULL if data can't be read.

Examples

## Not run: 
foo <- read_data(file = "my_data.csv")

## End(Not run)

Save Data To Various Connectors

Description

Save Data To Various Connectors

Usage

save_data(..., verbose = FALSE)

Arguments

...

arguments to pass to connector (see details)

verbose

a logical (default = FALSE) to indicate if additional traces should be sent to the console

Details

The save_data function is a wrapper around connector functions. It offers a single point of access to the package data persistence features.

Arguments passed to ... depend on the desired connector:

Value

the output of the connector function

Examples

## Not run: 
# -- file connector
save_data(file = "my_data.csv", path = getwd())

## End(Not run)

Convert ISO-8601 Character Columns to POSIXct

Description

Convert ISO-8601 Character Columns to POSIXct

Usage

to_POSIXct(data, names_ct)

Arguments

data

a data.frame

names_ct

the names of the columns to convert

Value

a data.frame with converted columns

Examples

to_POSIXct(data.frame(a = "2025-05-13T12:15:30+0200"), "a")

Write Data

Description

Write Data

Usage

write_data(
  x,
  path = Sys.getenv("DATA_HOME"),
  resource = NULL,
  file,
  delim = ",",
  verbose = FALSE
)

Arguments

x

A data frame to write to disk.

path

A path where to write the data (see details).

resource

An optional resource name (used as sub folder inside path).

file

The name of the file to write (with extension)

delim

Single character used to separate fields within a record.

verbose

If TRUE, additional messages will be sent to the console

Details

By default, path takes its value from the DATA_HOME environment variable. If it's not set in the environment and no value has been provided, function will be stopped (and return FALSE). If the corresponding path does not exist, it won't be created - to avoid creating data inside a container if the mount has not been done for example. When NULL, no check will be done.

Resource is an optional parameter to allow the use of sub folder inside path. If not NULL, it will be concatenated to path (and created inside path if it does not exist) When path is NULL, it will be ignored.

Columns with POSIXct type will be converted to ISO-8601 character columns before writing the file

Value

returns the input x invisibly, or FALSE when it fails

Examples

## Not run: 
write_data(foo, file = "my_data.csv")

## End(Not run)