Skip to content

Commit cb78d08

Browse files
committed
lintr fixes
1 parent 864c808 commit cb78d08

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

R/run-pgs-statistics.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ analyze.pgs.binary.predictiveness <- function(
531531
OR.Upper.CI = NA,
532532
p.value = NA
533533
));
534-
}
534+
}
535535
} else { # if ROC doesn't compute
536536
results.df <- rbind(results.df, data.frame(
537537
phenotype = current.phenotype,
@@ -568,7 +568,7 @@ analyze.pgs.binary.predictiveness <- function(
568568
panel.counter <- 1;
569569

570570
# Pre-calculate colors for all unique PGSs (to maintain consistent coloring across plots)
571-
max.colors = 12;
571+
max.colors <- 12;
572572
if (length(pgs.columns) < max.colors) {
573573
pgs.line.colours <- BoutrosLab.plotting.general::default.colours(length(pgs.columns));
574574
} else {
@@ -712,11 +712,11 @@ analyze.pgs.binary.predictiveness <- function(
712712
roc.plot <- roc.multipanel;
713713
} else {# If no plotting data exists
714714
warning('No ROC curves could be generated for plotting')
715-
}
715+
}
716716

717717
return(list(
718718
results.df = results.df,
719719
roc.plot = roc.plot
720720
));
721721

722-
} # End function
722+
} # End function

tests/testthat/test-pgs-statistics.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ test.data <- data.frame( # Changed to dot case
237237
Pheno.Binary.01 = factor(sample(c(0, 1), 100, replace = TRUE), levels = c(0, 1)), # Changed to dot case
238238
Pheno.Binary.TF = factor(sample(c(FALSE, TRUE), 100, replace = TRUE), levels = c(FALSE, TRUE)), # Changed to dot case
239239
Pheno.Binary.Numeric.01 = sample(c(0, 1), 100, replace = TRUE), # Changed to dot case
240-
Pheno.Binary.Char.YesNo = sample(c("Yes", "No"), 100, replace = TRUE), # Changed to dot case
240+
Pheno.Binary.Char.YesNo = sample(c('Yes', 'No'), 100, replace = TRUE), # Changed to dot case
241241
Pheno.Binary.3Levels = factor(sample(c(0, 1, 2), 100, replace = TRUE), levels = c(0,1,2)), # Changed to dot case
242242
Pheno.Continuous.Num = rnorm(100, mean = 50, sd = 10), # Changed to dot case
243243
Cov.Age = rnorm(100, mean = 40, sd = 10), # Changed to dot case
244-
Cov.Sex = factor(sample(c("M", "F"), 100, replace = TRUE)), # Changed to dot case
244+
Cov.Sex = factor(sample(c('M', 'F'), 100, replace = TRUE)), # Changed to dot case
245245
NonNumericPGS = as.character(rnorm(100)), # Changed to dot case
246246
stringsAsFactors = FALSE
247247
);
@@ -455,7 +455,7 @@ test_that(
455455
# Test 13: Too many PGS columns for default.colours (if 'scales' is NOT installed)
456456
# This test is conditional on 'scales' package availability.
457457
# If 'scales' is installed, this test will be skipped.
458-
if (isFALSE(requireNamespace("scales", quietly = TRUE))) {
458+
if (isFALSE(requireNamespace('scales', quietly = TRUE))) {
459459
many.pgs.data <- data.frame(
460460
ID = 1:10,
461461
Pheno.Binary.01 = factor(sample(c(0,1), 10, replace = TRUE), levels = c(0,1))
@@ -470,7 +470,7 @@ test_that(
470470
phenotype.columns = 'Pheno.Binary.01',
471471
phenotype.type = 'binary',
472472
output.dir = temp.output.dir,
473-
filename.prefix = "test"
473+
filename.prefix = 'test'
474474
),
475475
'Too many PGS columns selected, default.colours supports 12 or fewer.'
476476
);
@@ -483,7 +483,7 @@ test_that(
483483
test.data.no.complete.cases <- data.frame(
484484
ID = 1:10,
485485
PGS.A = c(rnorm(2), rep(NA, 8)), # Mostly NA
486-
Pheno.Binary.01 = factor(c(rep(NA, 8), sample(c(0,1), 2, replace=TRUE)), levels=c(0,1))
486+
Pheno.Binary.01 = factor(c(rep(NA, 8), sample(c(0,1), 2, replace = TRUE)), levels = c(0,1))
487487
);
488488
expect_warning(
489489
results <- analyze.pgs.binary.predictiveness(
@@ -502,7 +502,7 @@ test_that(
502502
test.data.bad.glm <- data.frame(
503503
ID = 1:10,
504504
PGS.A = rep(1, 10), # No variance in PGS
505-
Pheno.Binary.01 = factor(sample(c(0,1), 10, replace=TRUE), levels=c(0,1))
505+
Pheno.Binary.01 = factor(sample(c(0,1), 10, replace = TRUE), levels = c(0,1))
506506
);
507507
expect_warning(
508508
results <- analyze.pgs.binary.predictiveness(
@@ -522,7 +522,7 @@ test_that(
522522
test.data.bad.roc <- data.frame(
523523
ID = 1:10,
524524
PGS.A = rnorm(10),
525-
Pheno.Binary.01 = factor(rep(0, 10), levels=c(0,1)) # All phenotype values are 0
525+
Pheno.Binary.01 = factor(rep(0, 10), levels = c(0, 1)) # All phenotype values are 0
526526
);
527527
expect_warning(
528528
results <- analyze.pgs.binary.predictiveness(

0 commit comments

Comments
 (0)