import_Dataset {LightLogR}R Documentation

Import a light logger dataset or related data

Description

Imports a dataset and does the necessary transformations to get the right column formats. Unless specified otherwise, the function will set the timezone of the data to UTC. It will also enforce an Id to separate different datasets and will order/arrange the dataset within each Id by Datetime. See the Details and Devices section for more information and the full list of arguments.

Usage

import_Dataset(device, ...)

import

Arguments

device

From what device do you want to import? For a few devices, there is a sample data file that you can use to test the function (see the examples). See supported.devices for a list of supported devices and see below for more information on devices with specific requirements.

...

Parameters that get handed down to the specific import functions

Format

An object of class list of length 10.

Details

There are specific and a general import function. The general import function is described below, whereas the specific import functions take the form of import$device(). The general import function is a thin wrapper around the specific import functions. The specific import functions take the following arguments:

Value

Tibble/Dataframe with a POSIXct column for the datetime

Devices

The set of import functions provide a convenient way to import light logger data that is then perfectly formatted to add metadata, make visualizations and analyses. There are a number of devices supported, where import should just work out of the box. To get an overview, you can simply call the supported.devices dataset. The list will grow continuously as the package is maintained.

supported.devices
#>  [1] "Actiwatch_Spectrum" "ActLumus"           "ActTrust"          
#>  [4] "DeLux"              "LiDo"               "LightWatcher"      
#>  [7] "LYS"                "nanoLambda"         "Speccy"            
#> [10] "SpectraWear"

ActLumus

Manufacturer: Condor Instruments Model: ActLumus Implemented: 2023 A sample file is provided with the package, it can be accessed through system.file("extdata/205_actlumus_Log_1020_20230904101707532.txt.zip", package = "LightLogR"). It does not need to be unzipped to be imported. This sample file is a good example for a regular dataset without gaps

LYS

Manufacturer: LYS Technologies Model: LYS Button Implemented: 2023 A sample file is provided with the package, it can be accessed through system.file("extdata/sample_data_LYS.csv", package = "LightLogR"). This sample file is a good example for an irregular dataset.

Actiwatch_Spectrum

Manufacturer: Philips Respironics Model: Actiwatch Spectrum Implemented: 2023 Required Argument: column_names A character vector containing column names in the order in which they appear in the file. This is necessary to find the starting point of actual data.

ActTrust

Manufacturer: Condor Instruments Model: ActTrust1, ActTrust2 Implemented: 2024 This function works for both ActTrust 1 and 2 devices

Speccy

Manufacturer: Monash University Model: Speccy Implemented: 2024

DeLux

Manufacturer: Intelligent Automation Inc Model: DeLux Implemented: 2023

LiDo

Manufacturer: University of Lucerne Model: LiDo Implemented: 2023

SpectraWear

Manufacturer: Model: SpectraWear Implemented: 2024

NanoLambda

Manufacturer: NanoLambda Model: XL-500 BLE Implemented: 2024

LightWatcher

Manufacturer: Object-Tracker Model: LightWatcher Implemented: 2024

Examples

Imports made easy

To import a file, simple specify the filename (and path) and feed it to the import_Dataset function. There are sample datasets for all devices.

The import functions provide a basic overview of the data after import, such as the intervals between measurements or the start and end dates.

filepath <- system.file("extdata/sample_data_LYS.csv", package = "LightLogR")
dataset <- import_Dataset("LYS", filepath, auto.plot = FALSE)
#> 
#> Successfully read in 11'422 observations across 1 Ids from 1 LYS-file(s).
#> Timezone set is UTC.
#> The system timezone is Europe/Berlin. Please correct if necessary!
#> 
#> First Observation: 2023-06-21 00:00:12
#> Last Observation: 2023-06-22 23:59:48
#> Timespan: 2 days
#> 
#> Observation intervals: 
#>   Id              interval.time     n pct    
#> 1 sample_data_LYS 15s           10015 87.689%
#> 2 sample_data_LYS 16s            1367 11.969%
#> 3 sample_data_LYS 17s              23 0.201% 
#> 4 sample_data_LYS 18s              16 0.140%

Import functions can also be called directly:

filepath <- system.file("extdata/205_actlumus_Log_1020_20230904101707532.txt.zip", package = "LightLogR")
dataset <- import$ActLumus(filepath, auto.plot = FALSE)
#> 
#> Successfully read in 61'016 observations across 1 Ids from 1 ActLumus-file(s).
#> Timezone set is UTC.
#> The system timezone is Europe/Berlin. Please correct if necessary!
#> 
#> First Observation: 2023-08-28 08:47:54
#> Last Observation: 2023-09-04 10:17:04
#> Timespan: 7.1 days
#> 
#> Observation intervals: 
#>   Id                                          interval.time     n pct  
#> 1 205_actlumus_Log_1020_20230904101707532.txt 10s           61015 100%
dataset %>% gg_days()

unnamed-chunk-1-1.png

dataset %>%
dplyr::select(Datetime, TEMPERATURE, LIGHT, MEDI, Id) %>%
dplyr::slice(1500:1505)
#> # A tibble: 6 x 5
#> # Groups:   Id [1]
#>   Datetime            TEMPERATURE LIGHT  MEDI Id                                
#>   <dttm>                    <dbl> <dbl> <dbl> <fct>                             
#> 1 2023-08-28 12:57:44        26.9  212.  202. 205_actlumus_Log_1020_20230904101~
#> 2 2023-08-28 12:57:54        26.9  208.  199. 205_actlumus_Log_1020_20230904101~
#> 3 2023-08-28 12:58:04        26.9  205.  196. 205_actlumus_Log_1020_20230904101~
#> 4 2023-08-28 12:58:14        26.8  204.  194. 205_actlumus_Log_1020_20230904101~
#> 5 2023-08-28 12:58:24        26.9  203.  194. 205_actlumus_Log_1020_20230904101~
#> 6 2023-08-28 12:58:34        26.8  204.  195. 205_actlumus_Log_1020_20230904101~

See Also

supported.devices


[Package LightLogR version 0.3.8 Index]