Function to extract relevant header fields and values from a file.
Usage
header.info(binfile, more=TRUE)
Arguments
binfile
The file from which to extract the header
more
logical. If TRUE, extract additional data from file useful for calibration and data reading.
Details
The function extracts useful information from a .bin file, such as information about the GENEA device used to produce the output, and characteristics of the subject who wore the device. The function also accepts data that has been compressed in ‘gzip’, ‘bzip2’ or ‘xz’ formats. See file.
With more set to TRUE, additional data is extracted, mainly for internal use in read.bin.
Value
A data.frame with extracted header information, each row a particular header field with its value.
If more is TRUE, an attribute "calibration" is attached to the object, consisting of a list with measurement offsets, sampling frequency estimates, start times and time zones, data position offsets, and if mmap is detected, byte locations and increments for mmap reading.
Warning
This function is specific to header structure in GENEActiv output files. By design, it should be compatible with all firmware and software versions to date (as of version of current release). If order or field names are changed in future .bin files, this function may have to be updated appropriately.
The function works by looking for appropriate section headings in the .bin files.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GENEAread)
Loading required package: bitops
GENEAread 1.1.1 loaded
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GENEAread/header.info.Rd_%03d_medium.png", width=480, height=480)
> ### Name: header.info
> ### Title: Get header info from GENEA output (.bin) file
> ### Aliases: header.info
> ### Keywords: IO
>
> ### ** Examples
>
>
> fileheader <- header.info(system.file("binfile/TESTfile.bin", package = "GENEAread")[1], more = TRUE)
> print(fileheader)
Value
Device_Unique_Serial_Code 011073
Measurement_Frequency 100.0
Measurement_Period 168 Hours
Start_Time 0000-00-00 00:00:00:000
Study_Centre TESTCenter
Study_Code TESTCode
Investigator_ID TESTID
Exercise_Type Sample Code
Device_Location_Code left wrist
Subject_Code TESTSubject
Date_of_Birth 1900-1-1
Sex male
Height 160
Weight 100
Handedness_Code right
Number_of_Pages 104
Decimal_Separator .
> attr(fileheader, "calibration")
$tzone
[1] 1
$xgain
[1] 25344
$xoffset
[1] 1104
$ygain
[1] 25870
$yoffset
[1] 454
$zgain
[1] 25470
$zoffset
[1] -1433
$volts
[1] 300
$lux
[1] 800
$npages
[1] 104
$firstpage
[1] 0
$freq
[1] 100
$t1
[1] 1337791670
$t1c
[1] "2012-05-24 00:47:50 JST"
$inc
[1] 0.01
$t1midnight
[1] 1337731200
$headlines
[1] 59
>
>
>
>
>
> dev.off()
null device
1
>