import_adjustment {LightLogR}R Documentation

Adjust device imports or make your own

Description

Adjust device imports or make your own

Usage

import_adjustment(import_expr)

Arguments

import_expr

A named list of import expressions. The basis for LightLogR's import functions is the included dataset ll_import_expr. If this function were to be given that exact dataset, and bound to a variable called import, it would be identical to the import function. See details.

Details

This function should only be used with some knowledge of how expressions work in R. The minimal required output for an expression to work as expected, it must lead to a data frame containing a Datetime column with the correct time zone. It has access to all arguments defined in the description of import_Dataset(). The ... argument should be passed to whatever csv reader function is used, so that it works as expected. Look at ll_import_expr$LYS for a quite minimal example.

Value

A list of import functions

Examples

#create a new import function for the LYS device, same as the old
new_import <- import_adjustment(ll_import_expr)
#the new one is identical to the old one in terms of the function body
identical(body(import$LYS), body(new_import$LYS))

#change the import expression for the LYS device to add a message at the top
ll_import_expr$LYS[[4]] <-
rlang::expr({ cat("**This is a new import function**\n")
data
})
new_import <- import_adjustment(ll_import_expr)
filepath <- system.file("extdata/sample_data_LYS.csv", package = "LightLogR")
#Now, a message is printed when the import function is called
new_import <- new_import$LYS(filepath)

[Package LightLogR version 0.3.8 Index]