1 2R version 4.1.1 (2021-08-10) -- "Kick Things" 3Copyright (C) 2021 The R Foundation for Statistical Computing 4Platform: x86_64-w64-mingw32/x64 (64-bit) 5 6R is free software and comes with ABSOLUTELY NO WARRANTY. 7You are welcome to redistribute it under certain conditions. 8Type 'license()' or 'licence()' for distribution details. 9 10R is a collaborative project with many contributors. 11Type 'contributors()' for more information and 12'citation()' on how to cite R or R packages in publications. 13 14Type 'demo()' for some demos, 'help()' for on-line help, or 15'help.start()' for an HTML browser interface to help. 16Type 'q()' to quit R. 17 18> # tests for is.pconsecutive 19> # 20> # in separate test file: tests for make.pconsecutive and make.pbalanced 21> 22> 23> 24> ############## test with consecutive and non-consecutive time periods #### 25> 26> library(plm) 27> data("Grunfeld", package = "plm") 28> Grunfeld_missing_period <- Grunfeld[-2, ] 29> 30> pGrunfeld <- pdata.frame(Grunfeld) 31> pGrunfeld_missing_period <- pdata.frame(Grunfeld_missing_period) # delete one time period of first individual (1-1936 is missing) 32> 33> # Expected results: 34> # Grunfeld: rep(TRUE, 10) 35> # Grunfeld_missing_period: c(FALSE, rep(TRUE, 9)) 36> 37> # test on data.frame 38> is.pconsecutive(Grunfeld) 39 1 2 3 4 5 6 7 8 9 10 40TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 41> is.pconsecutive(Grunfeld_missing_period) 42 1 2 3 4 5 6 7 8 9 10 43FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 44> 45> is.pconsecutive(Grunfeld, index=c("firm", "year")) 46 1 2 3 4 5 6 7 8 9 10 47TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 48> is.pconsecutive(Grunfeld_missing_period, index=c("firm", "year")) 49 1 2 3 4 5 6 7 8 9 10 50FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 51> 52> # should result in informative error message: is.pconsecutive(Grunfeld, index=c("firm") 53> # because we need both dimensions when index != NULL 54> ttC <- tryCatch(is.pconsecutive(Grunfeld, index=c("firm")), error=function(e) e, warning=function(w) w) 55> if(!is(ttC,"error")) stop("error for non supplied time dimension in index not working") 56> # print(ttC$message) 57> 58> # test with not ordered data.frame (ordered by id, time) 59> # [only necessary for data.frame as pdata.frames are always ordered this way] 60> Grun_not_ordered <- Grunfeld 61> Grun_not_ordered <- Grun_not_ordered[order(Grun_not_ordered$capital), ] 62> is.pconsecutive(Grun_not_ordered) 63 1 2 3 4 5 6 7 8 9 10 64TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 65> if (!isTRUE(all.equal(is.pconsecutive(Grun_not_ordered), rep(TRUE, 10), check.attributes = FALSE))) 66+ stop("wrong result for not ordered data.frame") 67> 68> 69> # test on pdata.frame 70> if (!all(is.pconsecutive(pGrunfeld))) 71+ stop("is.pconsecutive on pdata.frame: wrong result") 72> if (!isTRUE(all.equal(is.pconsecutive(pGrunfeld_missing_period), c(FALSE, rep(TRUE, 9)), check.names = FALSE))) 73+ stop("is.pconsecutive on pdata.frame: wrong result") 74> 75> 76> # test on panelmodel object 77> estimation_pGrunfeld <- plm(inv ~ value + capital, data = pGrunfeld) 78> estimation_pGrunfeld_missing_period <- plm(inv ~ value + capital, data = pGrunfeld_missing_period) 79> nobs(estimation_pGrunfeld) # 200 80[1] 200 81> nobs(estimation_pGrunfeld_missing_period) # 199 82[1] 199 83> 84> is.pconsecutive(estimation_pGrunfeld) 85 1 2 3 4 5 6 7 8 9 10 86TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 87> is.pconsecutive(estimation_pGrunfeld_missing_period) 88 1 2 3 4 5 6 7 8 9 10 89FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 90> 91> 92> # default method (by dispatching) 93> # test on "numeric" and "NULL" -> should execute is.pconsecutive.default 94> is.pconsecutive(Grunfeld$inv, id = Grunfeld$firm, time = Grunfeld$year) 95 1 2 3 4 5 6 7 8 9 10 96TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 97> is.pconsecutive(Grunfeld[["inv"]], id = Grunfeld$firm, time = Grunfeld$year) 98 1 2 3 4 5 6 7 8 9 10 99TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 100> is.pconsecutive(NULL, id = Grunfeld$firm, time = Grunfeld$year) 101 1 2 3 4 5 6 7 8 9 10 102TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 103> exp_res_arbitrary_vec <- rep(TRUE, 10) 104> # formal test 105> if (!isTRUE(all.equal(is.pconsecutive(Grunfeld$inv, id = Grunfeld$firm, time = Grunfeld$year), 106+ exp_res_arbitrary_vec, check.attributes = FALSE))) 107+ stop("not correct for arbitrary vector") 108> 109> 110> # test on pseries 111> pinv <- pGrunfeld$inv 112> pinv_missing_period <- pGrunfeld_missing_period$inv 113> 114> is.pconsecutive(pinv) 115 1 2 3 4 5 6 7 8 9 10 116TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 117> is.pconsecutive(pinv_missing_period) 118 1 2 3 4 5 6 7 8 9 10 119FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 120> 121> 122> ## more missing periods 123> Grunfeld_missing_periods <- Grunfeld[-c(2,6,7), ] 124> pGrunfeld_missing_periods <- pdata.frame(Grunfeld_missing_periods) 125> pinv_missing_periods <- pGrunfeld_missing_periods$inv 126> 127> 128> 129> ######## with different data set "Hedonic" 130> data("Hedonic", package = "plm") 131> Hed <- Hedonic 132> pHed <- pdata.frame(Hedonic, index = "townid") 133> Hed_missing_period <- Hedonic[-c(5,11), ] # delete 3-2 and 4-5 134> 135> pHed_missing_period <- pdata.frame(Hedonic, index = "townid") # make pdata.frame first to produce a time index 136> pHed_missing_period <- as.data.frame(pHed_missing_period) 137> pHed_missing_period <- pHed_missing_period[-c(5,11), ] # delete 3-2 and 4-5 138> pHed_missing_period <- pdata.frame(pHed_missing_period, index = c("townid", "time")) 139> 140> 141> # Expected results 142> # Hed: all TRUE (rep(TRUE, 92)) 143> # Hed_missing_period: 3rd and 4th individual FALSE, rest TRUE 144> expected_Hed <- rep(TRUE, 92) 145> expected_Hed_missing_period <- expected_Hed 146> expected_Hed_missing_period[c(3,4)] <- FALSE 147> 148> # test on data.frame 149> Hed_df <- as.data.frame(pHed) 150> Hed_df_missing_period <- as.data.frame(pHed_missing_period) 151> is.pconsecutive(Hed_df, index = c("townid", "time")) 152 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 153TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 154 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 155TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 156 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 157TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 158 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 159TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 160 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 161TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 162 81 82 83 84 85 86 87 88 89 90 91 92 163TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 164> is.pconsecutive(Hed_df_missing_period, index = c("townid", "time")) 165 1 2 3 4 5 6 7 8 9 10 11 12 13 166 TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 167 14 15 16 17 18 19 20 21 22 23 24 25 26 168 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 169 27 28 29 30 31 32 33 34 35 36 37 38 39 170 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 171 40 41 42 43 44 45 46 47 48 49 50 51 52 172 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 173 53 54 55 56 57 58 59 60 61 62 63 64 65 174 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 175 66 67 68 69 70 71 72 73 74 75 76 77 78 176 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 177 79 80 81 82 83 84 85 86 87 88 89 90 91 178 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 179 92 180 TRUE 181> 182> # test on pdata.frame 183> if(!isTRUE(all.equal(is.pconsecutive(pHed), expected_Hed, check.names = FALSE))) stop("is.pconsecutive on pdata.frame: wrong result") 184> if(!isTRUE(all.equal(is.pconsecutive(pHed_missing_period), expected_Hed_missing_period, check.names = FALSE))) stop("is.pconsecutive on pdata.frame: wrong result") 185> 186> # test on panelmodel object 187> estimation_pHed <- plm(mv ~ crim + indus, data = pHed) 188> estimation_pHed_missing_period <- plm(mv ~ crim + indus, data = pHed_missing_period) 189> 190> is.pconsecutive(estimation_pHed) 191 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 192TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 193 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 194TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 195 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 196TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 197 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 198TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 199 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 200TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 201 81 82 83 84 85 86 87 88 89 90 91 92 202TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 203> is.pconsecutive(estimation_pHed_missing_period) 204 1 2 3 4 5 6 7 8 9 10 11 12 13 205 TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 206 14 15 16 17 18 19 20 21 22 23 24 25 26 207 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 208 27 28 29 30 31 32 33 34 35 36 37 38 39 209 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 210 40 41 42 43 44 45 46 47 48 49 50 51 52 211 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 212 53 54 55 56 57 58 59 60 61 62 63 64 65 213 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 214 66 67 68 69 70 71 72 73 74 75 76 77 78 215 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 216 79 80 81 82 83 84 85 86 87 88 89 90 91 217 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 218 92 219 TRUE 220> 221> # test on pseries 222> pmv <- pHed$mv 223> pmv_missing_period <- pHed_missing_period$mv 224> 225> if(!isTRUE(all.equal(is.pconsecutive(pmv), expected_Hed, check.names = FALSE))) stop("is.pconsecutive on pseries: wrong result") 226> if(!isTRUE(all.equal(is.pconsecutive(pmv_missing_period), expected_Hed_missing_period, check.names = FALSE))) stop("is.pconsecutive on pseries: wrong result") 227> 228> ######## with different data set "Gasoline" (has "named" individuals, not just numbers) 229> data("Gasoline", package = "plm") 230> pGasoline <- pdata.frame(Gasoline) 231> 232> # test on data.frame 233> is.pconsecutive(Gasoline, index = c("country", "year")) 234 AUSTRIA BELGIUM CANADA DENMARK FRANCE GERMANY GREECE IRELAND 235 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 236 ITALY JAPAN NETHERLA NORWAY SPAIN SWEDEN SWITZERL TURKEY 237 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 238 U.K. U.S.A. 239 TRUE TRUE 240> 241> # test on pdata.frame 242> is.pconsecutive(pGasoline) 243 AUSTRIA BELGIUM CANADA DENMARK FRANCE GERMANY GREECE IRELAND 244 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 245 ITALY JAPAN NETHERLA NORWAY SPAIN SWEDEN SWITZERL TURKEY 246 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 247 U.K. U.S.A. 248 TRUE TRUE 249> 250> 251> 252> ######### test for case with a time period missing from whole data set 253> data("Grunfeld", package = "plm") 254> obs_3rd <- 3 + 20*c(0:9) 255> Grunfeld_wo_1937 <- pdata.frame(Grunfeld[-obs_3rd, ]) 256> 257> expected_Grunfeld_wo_1937 <- rep(FALSE, 10) 258> 259> if(!isTRUE(all.equal(is.pconsecutive(Grunfeld_wo_1937), expected_Grunfeld_wo_1937, check.names = FALSE))) 260+ stop("is.pconsecutive on pdata.frame: wrong result for a missing time period in whole data set") 261> 262> if(!isTRUE(all.equal(is.pconsecutive(Grunfeld_wo_1937$inv), expected_Grunfeld_wo_1937, check.names = FALSE))) 263+ stop("is.pconsecutive on pdata.frame: wrong result for a missing time period in whole data set") 264> 265> 266> ########## Tests with NA in individual and time index ########### 267> 268> 269> ### test with NA in time index ### 270> data("Grunfeld", package = "plm") # get fresh Grunfeld (no NAs) 271> Grunfeld_NA_time <- Grunfeld 272> Grunfeld_NA_time[2, "year"] <- NA # firm 1, year 1936: year set to NA 273> 274> pGrunfeld_NA_time <- pdata.frame(Grunfeld_NA_time) 275Warning message: 276In pdata.frame(Grunfeld_NA_time) : 277 at least one NA in at least one index dimension in resulting pdata.frame 278 to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany") 279 280> # time index with NA is in pdata.frame 281> # it gets sorted to end of firm 1 282> head(pGrunfeld_NA_time, 21) 283 firm year inv value capital 2841-1935 1 1935 317.6 3078.5 2.8 2851-1937 1 1937 410.6 5387.1 156.9 2861-1938 1 1938 257.7 2792.2 209.2 2871-1939 1 1939 330.8 4313.2 203.4 2881-1940 1 1940 461.2 4643.9 207.2 2891-1941 1 1941 512.0 4551.2 255.2 2901-1942 1 1942 448.0 3244.1 303.7 2911-1943 1 1943 499.6 4053.7 264.1 2921-1944 1 1944 547.5 4379.3 201.6 2931-1945 1 1945 561.2 4840.9 265.0 2941-1946 1 1946 688.1 4900.9 402.2 2951-1947 1 1947 568.9 3526.5 761.5 2961-1948 1 1948 529.2 3254.7 922.4 2971-1949 1 1949 555.1 3700.2 1020.1 2981-1950 1 1950 642.9 3755.6 1099.0 2991-1951 1 1951 755.9 4833.0 1207.7 3001-1952 1 1952 891.2 4924.9 1430.5 3011-1953 1 1953 1304.4 6241.7 1777.3 3021-1954 1 1954 1486.7 5593.6 2226.3 3031-NA 1 <NA> 391.8 4661.7 52.6 3042-1935 2 1935 209.9 1362.4 53.8 305> 306> expected_NA_time <- c(NA, rep(TRUE, 9)) 307> expected_NA_time_na.rm.tindex <- c(FALSE, rep(TRUE, 9)) 308> 309> is.pconsecutive(Grunfeld_NA_time) 310 1 2 3 4 5 6 7 8 9 10 311 NA TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 312> is.pconsecutive(Grunfeld_NA_time, na.rm.tindex = FALSE) 313 1 2 3 4 5 6 7 8 9 10 314 NA TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 315> is.pconsecutive(Grunfeld_NA_time, na.rm.tindex = TRUE) 316 1 2 3 4 5 6 7 8 9 10 317FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE 318> 319> if(!isTRUE(all.equal(is.pconsecutive(Grunfeld_NA_time), is.pconsecutive(pGrunfeld_NA_time)))) 320+ stop("is.pconsecutive not equal for data.frame and pdata.frame with 'NA' in time index") 321> if(!isTRUE(all.equal(is.pconsecutive(pGrunfeld_NA_time), expected_NA_time, check.names=FALSE))) 322+ stop("is.pconsecutive: not expected result with 'NA' in time index") 323> if(!isTRUE(all.equal(is.pconsecutive(pGrunfeld_NA_time, na.rm.tindex = TRUE), expected_NA_time_na.rm.tindex, check.names=FALSE))) 324+ stop("is.pconsecutive(, na.rm.tindex = TRUE: not expected result with 'NA' in time index - there should be no NA values left") 325> 326> ### test with NA in individual index ### 327> # get fresh Grunfeld (no NAs) 328> Grunfeld_NA_ind <- Grunfeld 329> Grunfeld_NA_ind[3, "firm"] <- NA # firm 1, year 1937: firm set to NA 330> pGrunfeld_NA_ind <- pdata.frame(Grunfeld_NA_ind) 331Warning message: 332In pdata.frame(Grunfeld_NA_ind) : 333 at least one NA in at least one index dimension in resulting pdata.frame 334 to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany") 335 336> 337> # individual index with NA is in pdata.frame 338> # it gets sorted to end of individuals 339> tail(pGrunfeld_NA_ind, 21) 340 firm year inv value capital 34110-1935 10 1935 2.54 70.91 4.50 34210-1936 10 1936 2.00 87.94 4.71 34310-1937 10 1937 2.19 82.20 4.57 34410-1938 10 1938 1.99 58.72 4.56 34510-1939 10 1939 2.03 80.54 4.38 34610-1940 10 1940 1.81 86.47 4.21 34710-1941 10 1941 2.14 77.68 4.12 34810-1942 10 1942 1.86 62.16 3.83 34910-1943 10 1943 0.93 62.24 3.58 35010-1944 10 1944 1.18 61.82 3.41 35110-1945 10 1945 1.36 65.85 3.31 35210-1946 10 1946 2.24 69.54 3.23 35310-1947 10 1947 3.81 64.97 3.90 35410-1948 10 1948 5.66 68.00 5.38 35510-1949 10 1949 4.21 71.24 7.39 35610-1950 10 1950 3.42 69.05 8.74 35710-1951 10 1951 4.67 83.04 9.07 35810-1952 10 1952 6.00 74.42 9.93 35910-1953 10 1953 6.53 63.51 11.68 36010-1954 10 1954 5.12 58.12 14.33 361NA-1937 <NA> 1937 410.60 5387.10 156.90 362> 363> expected_NA_ind <- c(FALSE, rep(TRUE, 9)) 364> 365> if(!isTRUE(all.equal(is.pconsecutive(Grunfeld_NA_ind), is.pconsecutive(pGrunfeld_NA_ind)))) 366+ stop("is.pconsecutive not equal for data.frame and pdata.frame with 'NA' in individual index") 367> if(!isTRUE(all.equal(is.pconsecutive(pGrunfeld_NA_ind), expected_NA_ind, check.names=FALSE))) 368+ stop("is.pconsecutive: not expected result with 'NA' in individual index") 369> 370> 371> 372> ### test with NA in individual AND time index ### 373> # get fresh Grunfeld (no NAs) 374> Grunfeld_NA_id_time <- Grunfeld 375> Grunfeld_NA_id_time[4, c("firm", "year")] <- NA # firm 1, year 1938: firm and year set to NA 376> pGrunfeld_NA_id_time <- pdata.frame(Grunfeld_NA_id_time) 377Warning message: 378In pdata.frame(Grunfeld_NA_id_time) : 379 at least one NA in at least one index dimension in resulting pdata.frame 380 to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany") 381 382> 383> # individual and time index with NA is in pdata.frame 384> # it gets sorted to end of individuals 385> tail(pGrunfeld_NA_id_time, 21) 386 firm year inv value capital 38710-1935 10 1935 2.54 70.91 4.50 38810-1936 10 1936 2.00 87.94 4.71 38910-1937 10 1937 2.19 82.20 4.57 39010-1938 10 1938 1.99 58.72 4.56 39110-1939 10 1939 2.03 80.54 4.38 39210-1940 10 1940 1.81 86.47 4.21 39310-1941 10 1941 2.14 77.68 4.12 39410-1942 10 1942 1.86 62.16 3.83 39510-1943 10 1943 0.93 62.24 3.58 39610-1944 10 1944 1.18 61.82 3.41 39710-1945 10 1945 1.36 65.85 3.31 39810-1946 10 1946 2.24 69.54 3.23 39910-1947 10 1947 3.81 64.97 3.90 40010-1948 10 1948 5.66 68.00 5.38 40110-1949 10 1949 4.21 71.24 7.39 40210-1950 10 1950 3.42 69.05 8.74 40310-1951 10 1951 4.67 83.04 9.07 40410-1952 10 1952 6.00 74.42 9.93 40510-1953 10 1953 6.53 63.51 11.68 40610-1954 10 1954 5.12 58.12 14.33 407NA-NA <NA> <NA> 257.70 2792.20 209.20 408> 409> expected_NA_ind_time <- c(FALSE, rep(TRUE, 9)) 410> 411> if(!isTRUE(all.equal(is.pconsecutive(Grunfeld_NA_id_time), is.pconsecutive(pGrunfeld_NA_id_time)))) 412+ stop("is.pconsecutive not equal for data.frame and pdata.frame with 'NA' in individual AND time index") 413> if(!isTRUE(all.equal(is.pconsecutive(pGrunfeld_NA_id_time), expected_NA_ind_time, check.names=FALSE))) 414+ stop("is.pconsecutive: not expected result with 'NA' in individual AND time index") 415> 416> 417> 418> 419> proc.time() 420 user system elapsed 421 3.82 0.54 4.48 422