Skip to content

Commit 2a79c08

Browse files
committed
Fix incomplete change from "LVCF" back to "LOCF"
1 parent bbd1c17 commit 2a79c08

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

tests/testthat/test-compactify.R

+16-13
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,55 @@ row_replace <- function(dt,row,x,y) {
2222
dt
2323
}
2424

25+
# Note that compactify is working on version-wise LOCF (last version of each
26+
# observation carried forward)
27+
2528
# Rows 1 should not be eliminated even if NA
26-
dt <- row_replace(dt,1,NA,NA) # Not LVCF
29+
dt <- row_replace(dt,1,NA,NA) # Not LOCF
2730

2831
# NOTE! We are assuming that there are no NA's in geo_value, time_value,
2932
# and version. Even though compactify may erroneously remove the first row
3033
# if it has all NA's, we are not testing this behaviour for now as this dataset
3134
# has problems beyond the scope of this test
3235

3336
# Rows 11 and 12 correspond to different time_values
34-
dt <- row_replace(dt,12,11,11) # Not LVCF
37+
dt <- row_replace(dt,12,11,11) # Not LOCF
3538

3639
# Rows 20 and 21 only differ in version
37-
dt <- row_replace(dt,21,20,20) # LVCF
40+
dt <- row_replace(dt,21,20,20) # LOCF
3841

3942
# Rows 21 and 22 only differ in version
40-
dt <- row_replace(dt,22,20,20) # LVCF
43+
dt <- row_replace(dt,22,20,20) # LOCF
4144

4245
# Row 39 comprises the first NA's
43-
dt <- row_replace(dt,39,NA,NA) # Not LVCF
46+
dt <- row_replace(dt,39,NA,NA) # Not LOCF
4447

4548
# Row 40 has two NA's, just like its lag, row 39
46-
dt <- row_replace(dt,40,NA,NA) # LVCF
49+
dt <- row_replace(dt,40,NA,NA) # LOCF
4750

4851
# Row 62's values already exist in row 15, but row 15 is not a preceding row
49-
dt <- row_replace(dt,62,15,15) # Not LVCF
52+
dt <- row_replace(dt,62,15,15) # Not LOCF
5053

5154
# Row 73 only has one value carried over
52-
dt <- row_replace(dt,74,73,74) # Not LVCF
55+
dt <- row_replace(dt,74,73,74) # Not LOCF
5356

5457
dt_true <- as_tibble(as_epi_archive(dt,compactify=TRUE)$DT)
5558
dt_false <- as_tibble(as_epi_archive(dt,compactify=FALSE)$DT)
5659
dt_null <- suppressWarnings(as_tibble(as_epi_archive(dt,compactify=NULL)$DT))
5760

58-
test_that("Warning for LVCF with compactify as NULL", {
61+
test_that("Warning for LOCF with compactify as NULL", {
5962
expect_warning(as_epi_archive(dt,compactify=NULL))
6063
})
6164

62-
test_that("No warning when there is no LVCF", {
65+
test_that("No warning when there is no LOCF", {
6366
expect_warning(as_epi_archive(dt[1:5],compactify=NULL),NA)
6467
})
6568

66-
test_that("LVCF values are ignored with compactify=FALSE", {
69+
test_that("LOCF values are ignored with compactify=FALSE", {
6770
expect_identical(nrow(dt),nrow(dt_false))
6871
})
6972

70-
test_that("LVCF values are taken out with compactify=TRUE", {
73+
test_that("LOCF values are taken out with compactify=TRUE", {
7174
dt_test <- as_tibble(as_epi_archive(dt[-c(21,22,40),],compactify=FALSE)$DT)
7275

7376
expect_identical(dt_true,dt_null)
@@ -78,7 +81,7 @@ test_that("as_of produces the same results with compactify=TRUE as with compacti
7881
ea_true <- as_epi_archive(dt,compactify=TRUE)
7982
ea_false <- as_epi_archive(dt,compactify=FALSE)
8083

81-
# Row 22, an LVCF row corresponding to the latest version, is omitted in
84+
# Row 22, an LOCF row corresponding to the latest version, is omitted in
8285
# ea_true
8386
latest_version = max(ea_false$DT$version)
8487
expect_warning({

0 commit comments

Comments
 (0)