Skip to content

Commit aa616c7

Browse files
committed
WIP
1 parent 92a0b5e commit aa616c7

3 files changed

Lines changed: 374 additions & 133 deletions

File tree

README.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ data <- read_data(datafile, guidefile)
4848

4949
The output of the `read_data()` function is a list object the format of which is determined for a large part by the design of the data guide.
5050

51-
## Details
51+
## How it works
5252

53-
### How it works
53+
When you design a template spreadsheet file for data reporting and analysis you also create a *data guide* file that specifies the structure and location of the data in the template. Examples of a template with data and of a data guide are provided in the package (`system.file("extdata", "example_data.xlsx", package = "excelDataGuide")` and `system.file("extdata", "example_guide.yml", package = "excelDataGuide")`).
5454

55-
When you design a template Excel file for data reporting and analysis you also create a *data guide* file that specifies the structure and location of the data in the template. If you design the template carefully you can use the same data guide for several versions of the template. That is, as long as the location of the indexed data does not change, you can use the same data guide for different versions of the template. You can specify the compatible version of the templates in the *data guide*. The package will check compatibility. Clearly, you should use versioned data templates, and hence, a required field in a template is its version number. An example of a template with data is provided in the package (`system.file("extdata", "example_data.xlsx", package = "excelDataGuide")`).
55+
Once you have entered the data and metadata in a template you can use the `read_data()` function in the package to extract the data into R with a single command. The package will check and coerce the data types to the required formats.
5656

57-
Once you have entered the data and metadata in a template you can use the package to extract the data into R. The package will check and coerce the data types to the required formats.
57+
Details about the data guide format and how to write one as well as about how to design a template can be found in the package vignettes.
5858

5959
### Data guide
6060

data-raw/excelguide_schema.cue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@
44
// This schema validates Excel template guide files that describe how to extract
55
// data from Excel workbooks with specific template formats.
66

7-
// Top-level required fields
7+
// REQUIRED FIELDS
8+
// Versions of guide and template
89
"guide.version"!: #Version
910
"template.name"!: string
1011
"template.min.version"!: #Version
1112
"template.max.version"!: #Version | null
12-
"plate.format"!: #Plateformat
13+
// Plate format
14+
"plate.format"!: #Plateformat
15+
// Locations
1316
"locations"!: [...#Location]
14-
"translations": [...#Translation]
17+
18+
// OPTIONAL FIELDS
19+
// Optional field translations
20+
"translations"?: [...#Translation]
1521

1622
// Optional field added by validate_and_sign.sh after successful CUE validation.
1723
// Format: sha256:<64 lowercase hex characters>
@@ -28,6 +34,7 @@
2834
// inside a for expression, which causes a "reference not found" error at vet time.
2935
// This constraint is enforced at runtime by check_guide() in R/guide.R instead.
3036

37+
// DEFINITIONS
3138
// Version constraint: must be in major.minor format (e.g., "1.0", "2.3")
3239
#Version: =~"^\\d+\\.\\d+$"
3340

0 commit comments

Comments
 (0)