View source: R/read_breathtest_excel.R
read_breathtest_excel | R Documentation |
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
read_breathtest_excel(filename, sheet = 1)
filename |
Name of Excel-file to be read |
sheet |
Name or number of Excel file to be read. When used with
|
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.