Skip to content

Commit c2b938a

Browse files
TRUE, not T
1 parent effa5cf commit c2b938a

4 files changed

Lines changed: 25 additions & 25 deletions

File tree

R/buildComponent.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
874874
if (config$verbose == TRUE) {
875875
cat(sprintf(verbose_message, length(idx)))
876876
}
877-
# consequence is missing data
877+
# consequence is missing data
878878
if (is.matrix(component) || methods::is(component, "Matrix")) {
879879
component <- component[idx, , drop = drop]
880880
} else {

R/buildComponentWrappers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,6 @@ ped2ce <- function(ped, personID = "ID",
201201
)
202202
return(mat)
203203
} else {
204-
matrix(1, nrow = nrow(ped), ncol = nrow(ped), dimnames = list(ped[[personID]], ped[[personID]]))
204+
matrix(1, nrow = nrow(ped), ncol = nrow(ped), dimnames = list(ped[[personID]], ped[[personID]]))
205205
}
206206
}

tests/testthat/test-buildComponent.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,11 @@ test_that("keep_ids subset produces correct relatedness values", {
379379

380380

381381
r_full <- ped2com(hazard,
382-
component = "additive", sparse = T,
382+
component = "additive", sparse = TRUE,
383383
keep_ids = NULL
384384
)
385385
r_sub <- ped2com(hazard,
386-
component = "additive", sparse = T,
386+
component = "additive", sparse = TRUE,
387387
keep_ids = keep
388388
)
389389

@@ -403,7 +403,7 @@ test_that("keep_ids subset produces correct relatedness values across all famili
403403
)
404404

405405
r_full_sparse <- ped2com(inbreeding,
406-
component = "additive", sparse = T,
406+
component = "additive", sparse = TRUE,
407407
keep_ids = NULL
408408
)
409409
for (i in unique(inbreeding$famID)) {
@@ -422,7 +422,7 @@ test_that("keep_ids subset produces correct relatedness values across all famili
422422

423423
r_full <- r_full_sparse
424424
r_sub <- ped2com(inbreeding,
425-
component = "additive", sparse = T,
425+
component = "additive", sparse = TRUE,
426426
keep_ids = keep
427427
)
428428

@@ -438,26 +438,26 @@ test_that("keep_ids subset produces correct relatedness values across all famili
438438
test_that("keep_ids subset produces correct relatedness values across all families", {
439439
library(ggpedigree)
440440
data(ASOIAF)
441-
df <-ASOIAF |> dplyr::rename(ID = id)
441+
df <- ASOIAF |> dplyr::rename(ID = id)
442442

443443
r_full_sparse <- ped2com(df,
444-
component = "additive", sparse = TRUE,
445-
keep_ids = NULL,
446-
mz_twins = FALSE
444+
component = "additive", sparse = TRUE,
445+
keep_ids = NULL,
446+
mz_twins = FALSE
447447
)
448448
for (i in unique(df$famID)) {
449449
n_rows <- sum(df$famID == i)
450450
if (n_rows < 3) {
451451
next
452452
}
453-
keep <- as.character(sample(df$ID[df$famID == i], min(15,n_rows)))
453+
keep <- as.character(sample(df$ID[df$famID == i], min(15, n_rows)))
454454

455455

456456
r_full <- r_full_sparse
457457
r_sub <- ped2com(df,
458-
component = "additive", sparse = TRUE,
459-
keep_ids = keep,
460-
mz_twins = FALSE
458+
component = "additive", sparse = TRUE,
459+
keep_ids = keep,
460+
mz_twins = FALSE
461461
)
462462

463463
expect_equal(dim(r_sub), c(length(keep), length(keep)))
@@ -466,15 +466,15 @@ df <-ASOIAF |> dplyr::rename(ID = id)
466466
# values in the subset must match the corresponding entries of the full matrix
467467
expect_equal(r_sub, r_full[keep, keep], tolerance = 1e-10, info = paste("Family", i))
468468

469-
#entirely random subset of IDs across the whole dataset (not just within family)
469+
# entirely random subset of IDs across the whole dataset (not just within family)
470470
keep <- as.character(sample(df$ID, 15))
471471

472472

473473
r_full <- r_full_sparse
474474
r_sub <- ped2com(df,
475-
component = "additive", sparse = TRUE,
476-
keep_ids = keep,
477-
mz_twins = FALSE
475+
component = "additive", sparse = TRUE,
476+
keep_ids = keep,
477+
mz_twins = FALSE
478478
)
479479

480480
expect_equal(dim(r_sub), c(length(keep), length(keep)))

tests/testthat/test-buildComponent_chunks.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ test_that("chunked tcrossprod matches standard tcrossprod", {
3232

3333
data(inbreeding)
3434
r_standard <- ped2com(inbreeding,
35-
component = "additive", sparse = T,
35+
component = "additive", sparse = TRUE,
3636
transpose_method = "tcrossprod"
3737
)
3838
r_chunked <- ped2com(inbreeding,
39-
component = "additive", sparse = T,
39+
component = "additive", sparse = TRUE,
4040
transpose_method = "chunked", chunk_size = 3L, force_symmetric = FALSE
4141
)
4242

4343
r_chunked_sym <- ped2com(inbreeding,
44-
component = "additive", sparse = T,
44+
component = "additive", sparse = TRUE,
4545
transpose_method = "chunked", chunk_size = 3L, force_symmetric = TRUE
4646
)
4747

@@ -86,11 +86,11 @@ test_that("chunked tcrossprod matches standard tcrossprod when also subsetted",
8686
keep <- as.character(inbreeding$ID[5:10])
8787

8888
r_full <- ped2com(inbreeding,
89-
component = "additive", sparse = T,
89+
component = "additive", sparse = TRUE,
9090
keep_ids = NULL
9191
)
9292
r_sub <- ped2com(inbreeding,
93-
component = "additive", sparse = T,
93+
component = "additive", sparse = TRUE,
9494
keep_ids = keep
9595
)
9696

@@ -101,9 +101,9 @@ test_that("chunked tcrossprod matches standard tcrossprod when also subsetted",
101101
expect_equal(r_sub, r_full[keep, keep], tolerance = 1e-10)
102102

103103
r_chunked <- ped2com(inbreeding,
104-
component = "additive", sparse = T,
104+
component = "additive", sparse = TRUE,
105105
transpose_method = "chunked", chunk_size = 3L,
106-
keep_ids = keep, force_symmetric = T
106+
keep_ids = keep, force_symmetric = TRUE
107107
)
108108

109109
expect_equal(as.matrix(r_sub), as.matrix(r_chunked), tolerance = 1e-10)

0 commit comments

Comments
 (0)