Skip to content

Commit f01ad2e

Browse files
committed
Merge branch 'nickel'
2 parents 09011aa + 2fe6d16 commit f01ad2e

File tree

4 files changed

+89
-2
lines changed

4 files changed

+89
-2
lines changed

R/read.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ read_data <- function(drfile, guide, checkname = FALSE) {
252252
rlang::abort(glue::glue("Unsupported location type: {location$type}"))
253253
)
254254

255-
atomicclass <- location$atomicclass %||% "character"
255+
# The default atomic class is "character"
256+
atomicclass <- if (!is.null(location$atomicclass)) location$atomicclass else "character"
256257

257258
# Read data using the appropriate function
258259
chunk <- if (location$type == "cells") {
@@ -324,9 +325,10 @@ combine_results <- function(existing, chunk, type) {
324325
#' @noRd
325326
validate_template_version <- function(template_version, guide) {
326327
if (grepl("^\\d+$", template_version)) {
328+
template_version_curr <- template_version
327329
template_version <- paste0(template_version, ".0")
328330
rlang::warn(glue::glue(
329-
"Incorrectly formatted template version number '{template_version}'. Version numbers must have a minor number. Interpreting as '{template_version}'."
331+
"Incorrectly formatted template version number '{template_version_curr}'. Version numbers must have a minor number. Interpreting as '{template_version}'."
330332
))
331333
}
332334

data-raw/schema.cue

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// usage: cue vet -c schema.cue file.yml
2+
3+
"guide.version"! : #Version
4+
"template.name"! : string
5+
"template.min.version"! : #Version
6+
"template.max.version"! : #Version | null
7+
"plate.format"! : #Plateformat
8+
"locations"! : [...#Location]
9+
"translations" : [...#Translation]
10+
11+
#Version: =~ "^\\d+\\.\\d+$" // Only version numbers in major.minor format allowed
12+
13+
#Plateformat: 96 | 384
14+
15+
//#AnyLocation: {
16+
// "sheet"! : string
17+
// "varname"! : #VariableName
18+
// "translate"? : bool | *false
19+
// "atomicclass"? : #Atom | [...#Atom] | *"character"
20+
//}
21+
22+
//#CellLocation: {
23+
// "type"! : "cells"
24+
// "variables"! : [...#Variable]
25+
// ...
26+
//}
27+
28+
//#RangeLocation: {
29+
// "type"! : "keyvalue" | "platedata" | "table"
30+
// "ranges"! : [...#Range]
31+
// ...
32+
//}
33+
34+
// This does not work:
35+
// #Location: #AnyLocation & {#CellLocation | #RangeLocation}
36+
37+
#Location: {
38+
"sheet"! : string
39+
"varname"! : #VariableName
40+
"translate"? : bool | *false
41+
"type"! : "cells"
42+
"variables"! : [...#Variable]
43+
"atomicclass"? : #Atom | [...#Atom] | *"character"
44+
} | {
45+
"sheet"! : string
46+
"varname"! : #VariableName
47+
"translate"? : bool | *false
48+
"type"! : "keyvalue" | "platedata" | "table"
49+
"ranges"! : [...#Range]
50+
"atomicclass"? : #Atom | [...#Atom] | *"character"
51+
}
52+
53+
#Variable: {
54+
"name"! : #VariableName
55+
"cell"! : #Cell
56+
}
57+
58+
#Translation: {
59+
"short"! : string
60+
"long"! : string
61+
}
62+
63+
#Atom : "character" | "date" | "numeric"
64+
65+
#Range : =~ "^[A-Z]\\d+:[A-Z]\\d+$" // Valid spreadsheed range value required
66+
67+
#Cell : =~ "^[A-Z]\\d+$" // Valid spreadsheed cell value required
68+
69+
#VariableName : =~ "[^\\s]" // variable names are not allowed to contain space-like characters

data-raw/shell.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Install the nix package manager if it is not available: https://nixos.org/download/#download-nix
2+
# This nix shell definition lets you run 'cue' in a nix shell.
3+
# Install it by running the command 'nix-shell' in a terminal in this folder, then run `cue` in the
4+
# nix shell. Enter 'exit' to exit the nix shell.
5+
6+
let
7+
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.05";
8+
pkgs = import nixpkgs { config = {}; overlays = []; };
9+
in
10+
11+
pkgs.mkShellNoCC {
12+
packages = with pkgs; [
13+
cue
14+
];
15+
}

man/excelDataGuide-package.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)