read_breathtest_excel {breathtestcore}R Documentation

Reads breathtest data in Excel format

Description

Can read several formats of data sets in Excel, from 2 (minute, pdr or dob for 1 record) to 4 columns (patient_id, group, minute, pdr or dob). Conversion from dob to pdf is done for assuming 180 cm height and 75 kg weight. See the example below with several sheets for supported formats

Usage

read_breathtest_excel(filename, sheet = 1)

Arguments

filename

Name of Excel-file to be read

sheet

Name or number of Excel file to be read. When used with read_any_breathtest, the first sheet is always read. You must call read_breathtest_excel explicitly to read other worksheets, as shown in the example below.

Value

Different from the other readXXX function, this returns a list with a data frame, not a structure of breathtest_data. Pass result through cleanup_data to make it compatible with other formats.

Examples

filename = btcore_file("ExcelSamples.xlsx")
sheets = readxl::excel_sheets(filename)
# First 4 lines of each sheet
for (sheet in sheets) {
  cat("\nSheet ", sheet,"\n")
  ex = readxl::read_excel(filename, sheet = sheet, n_max = 4)
  print(ex)
}  
# To get consistently formatted data from a sheet
bt_data = read_breathtest_excel(filename, sheets[6])
# 3 columns
str(bt_data)
bt_cleaned = cleanup_data(bt_data)
# 4 columns standard format
str(bt_cleaned)

[Package breathtestcore version 0.8.7 Index]