Skip to content

Commit 3d3cc18

Browse files
committed
handle clusters that contain no values
1 parent 3969e31 commit 3d3cc18

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

R/helpers.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@
242242
outIDs <- ids
243243
outObs <- obs
244244

245+
# first, test that any column contains any value
246+
if(!any(!is.na(obs[[1]]))) return(NULL)
247+
245248
uniqueIDs <- map(.x = seq_along(ids), .f = function(ix){
246249
unique(unlist(ids[[ix]]))
247250
})
@@ -304,7 +307,6 @@
304307
wideID[[1]] <- wideID[[1]] %>%
305308
select(-all_of(naCol))
306309
}
307-
308310
}
309311
tempDim <- dim(temp)
310312

R/reorganise.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ reorganise <- function(input = NULL, schema = NULL){
7272
# ids = idVars[[i]]; obs = obsVars[[i]]; clust = clusterVar[i]; grp = groupVar[i]
7373
tidyVars <- .tidyVars(ids = idVars[[i]], obs = obsVars[[i]],
7474
clust = clusterVar[i], grp = groupVar[i])
75+
if(is.null(tidyVars)) next
7576

7677
# put together the table
7778
theTable <- bind_cols(tidyVars, .name_repair = "minimal")

cran-comments.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
30.06.2021
2-
3-
changing 'https://www.tidyverse.org/lifecycle/#maturing' to 'https://lifecycle.r-lib.org/articles/stages.html'!
4-
5-
11.05.2020
6-
7-
- fix crucial typo in DESCRIPTION
8-
9-
10.05.2020
10-
11-
- More details in DESCRIPTION
12-
- Better description of all included functions
13-
- A descriptive example for each exported function (makeSchema, reorganise)
1+
30.06.2021
2+
3+
changing 'https://www.tidyverse.org/lifecycle/#maturing' to 'https://lifecycle.r-lib.org/articles/stages.html'!
4+
5+
11.05.2020
6+
7+
- fix crucial typo in DESCRIPTION
8+
9+
10.05.2020
10+
11+
- More details in DESCRIPTION
12+
- Better description of all included functions
13+
- A descriptive example for each exported function (makeSchema, reorganise)
1414
- proper description of return value for all functions

0 commit comments

Comments
 (0)