Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(psidR)
  > 
  > test_check("psidR")
  DEBUG [2025-12-22 07:55:21] years:
  
  [1] 1985 1986
  DEBUG [2025-12-22 07:55:21] datadir: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/
  DEBUG [2025-12-22 07:55:21] any.wealth? 0
  DEBUG [2025-12-22 07:55:21] datadir contains: 
  
  [1] "FAM1985ER.rda"   "FAM1986ER.RData" "IND2017ER.RData"
  DEBUG [2025-12-22 07:55:21] family df:
  
     year file
  18 1985 1074
  19 1986 1075
  INFO [2025-12-22 07:55:21] found FAM1985ER.rda already downloaded
  INFO [2025-12-22 07:55:21] found FAM1986ER.rda already downloaded
  INFO [2025-12-22 07:55:21] Will download missing datasets now
  INFO [2025-12-22 07:55:21] will download latest individual index: IND2021ER
  This can take several hours/days to download.
   want to go ahead? give me 'yes' or 'no'.
  INFO [2025-12-22 07:55:21] psidR: Loading Family data from .rda files
  INFO [2025-12-22 07:55:21] psidR: loaded individual file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/IND2017ER.RData
  INFO [2025-12-22 07:55:21] psidR: total memory load in MB: 1
  DEBUG [2025-12-22 07:55:21] psidR: here is the list of hardcoded PSID variables
  DEBUG [2025-12-22 07:55:21] psidR: The merge is based on equal values in ind.interview and fam.interview
  DEBUG [2025-12-22 07:55:22] ids:
  
  Key: <year>
       year ind.interview ind.seq ind.head ind.head.num fam.interview stratum
      <num>        <char>  <char>   <char>        <num>        <char>  <char>
   1:  1968       ER30001    <NA>  ER30003            1            V3 ER31996
   2:  1969       ER30020 ER30021  ER30022            1          V442 ER31996
   3:  1970       ER30043 ER30044  ER30045            1         V1102 ER31996
   4:  1971       ER30067 ER30068  ER30069            1         V1802 ER31996
   5:  1972       ER30091 ER30092  ER30093            1         V2402 ER31996
   6:  1973       ER30117 ER30118  ER30119            1         V3002 ER31996
   7:  1974       ER30138 ER30139  ER30140            1         V3402 ER31996
   8:  1975       ER30160 ER30161  ER30162            1         V3802 ER31996
   9:  1976       ER30188 ER30189  ER30190            1         V4302 ER31996
  10:  1977       ER30217 ER30218  ER30219            1         V5202 ER31996
  11:  1978       ER30246 ER30247  ER30248            1         V5702 ER31996
  12:  1979       ER30283 ER30284  ER30285            1         V6302 ER31996
  13:  1980       ER30313 ER30314  ER30315            1         V6902 ER31996
  14:  1981       ER30343 ER30344  ER30345            1         V7502 ER31996
  15:  1982       ER30373 ER30374  ER30375            1         V8202 ER31996
  16:  1983       ER30399 ER30400  ER30401           10         V8802 ER31996
  17:  1984       ER30429 ER30430  ER30431           10        V10002 ER31996
  18:  1985       ER30463 ER30464  ER30465           10        V11102 ER31996
  19:  1986       ER30498 ER30499  ER30500           10        V12502 ER31996
  20:  1987       ER30535 ER30536  ER30537           10        V13702 ER31996
  21:  1988       ER30570 ER30571  ER30572           10        V14802 ER31996
  22:  1989       ER30606 ER30607  ER30608           10        V16302 ER31996
  23:  1990       ER30642 ER30643  ER30644           10        V17702 ER31996
  24:  1991       ER30689 ER30690  ER30691           10        V19002 ER31996
  25:  1992       ER30733 ER30734  ER30735           10        V20302 ER31996
  26:  1993       ER30806 ER30807  ER30808           10        V21602 ER31996
  27:  1994       ER33101 ER33102  ER33103           10        ER2002 ER31996
  28:  1995       ER33201 ER33202  ER33203           10        ER5002 ER31996
  29:  1996       ER33301 ER33302  ER33303           10        ER7002 ER31996
  30:  1997       ER33401 ER33402  ER33403           10       ER10002 ER31996
  31:  1999       ER33501 ER33502  ER33503           10       ER13002 ER31996
  32:  2001       ER33601 ER33602  ER33603           10       ER17002 ER31996
  33:  2003       ER33701 ER33702  ER33703           10       ER21002 ER31996
  34:  2005       ER33801 ER33802  ER33803           10       ER25002 ER31996
  35:  2007       ER33901 ER33902  ER33903           10       ER36002 ER31996
  36:  2009       ER34001 ER34002  ER34003           10       ER42002 ER31996
  37:  2011       ER34101 ER34102  ER34103           10       ER47302 ER31996
  38:  2013       ER34201 ER34202  ER34203           10       ER53002 ER31996
  39:  2015       ER34301 ER34302  ER34303           10       ER60002 ER31996
  40:  2017       ER34501 ER34502  ER34503           10       ER66002 ER31996
  41:  2019       ER34701 ER34702  ER34703           10       ER72002 ER31996
  42:  2021       ER34901 ER34902  ER34903           10       ER78002 ER31996
       year ind.interview ind.seq ind.head ind.head.num fam.interview stratum
  INFO [2025-12-22 07:55:22] psidR: currently working on data for year 1985
  DEBUG [2025-12-22 07:55:22] ind.vars.yr:
  
     ind.weight
         <char>
  1:    ER30497
  DEBUG [2025-12-22 07:55:22] ind.notnas:
  
     ind.weight
         <char>
  1:    ER30497
  DEBUG [2025-12-22 07:55:22] loaded family file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/FAM1985ER.rda
  DEBUG [2025-12-22 07:55:22] current memory load in MB: 1
  INFO [2025-12-22 07:55:22] psidR: currently working on data for year 1986
  DEBUG [2025-12-22 07:55:22] ind.vars.yr:
  
     ind.weight
         <char>
  1:    ER30534
  DEBUG [2025-12-22 07:55:22] ind.notnas:
  
     ind.weight
         <char>
  1:    ER30534
  DEBUG [2025-12-22 07:55:22] loaded family file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/FAM1986ER.RData
  DEBUG [2025-12-22 07:55:22] current memory load in MB: 1
  Saving _problems/test_buildpanel-30.R
  INFO [2025-12-22 07:55:22] found FAM1985ER.rda already downloaded
  INFO [2025-12-22 07:55:22] found FAM1986ER.rda already downloaded
  INFO [2025-12-22 07:55:22] Will download missing datasets now
  INFO [2025-12-22 07:55:22] will download latest individual index: IND2021ER
  This can take several hours/days to download.
   want to go ahead? give me 'yes' or 'no'.
  INFO [2025-12-22 07:55:22] psidR: Loading Family data from .rda files
  INFO [2025-12-22 07:55:22] psidR: loaded individual file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/IND2017ER.RData
  INFO [2025-12-22 07:55:22] psidR: total memory load in MB: 1
  INFO [2025-12-22 07:55:22] psidR: currently working on data for year 1985
  INFO [2025-12-22 07:55:22] dropping non-heads leaves 1037 obs
  INFO [2025-12-22 07:55:22] psidR: currently working on data for year 1986
  INFO [2025-12-22 07:55:22] dropping non-heads leaves 985 obs
  Saving _problems/test_buildpanel-70.R
  INFO [2025-12-22 07:55:23] found FAM1985ER.rda already downloaded
  INFO [2025-12-22 07:55:23] found FAM1986ER.rda already downloaded
  INFO [2025-12-22 07:55:23] Will download missing datasets now
  INFO [2025-12-22 07:55:23] will download latest individual index: IND2021ER
  This can take several hours/days to download.
   want to go ahead? give me 'yes' or 'no'.
  INFO [2025-12-22 07:55:23] psidR: Loading Family data from .rda files
  INFO [2025-12-22 07:55:23] psidR: loaded individual file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/IND2017ER.RData
  INFO [2025-12-22 07:55:23] psidR: total memory load in MB: 1
  INFO [2025-12-22 07:55:23] psidR: currently working on data for year 1985
  INFO [2025-12-22 07:55:23] dropping non-current-heads leaves 805 obs
  INFO [2025-12-22 07:55:23] psidR: currently working on data for year 1986
  INFO [2025-12-22 07:55:23] dropping non-current-heads leaves 751 obs
  Saving _problems/test_buildpanel-87.R
  INFO [2025-12-22 07:55:23] found FAM1985ER.rda already downloaded
  INFO [2025-12-22 07:55:23] found FAM1986ER.rda already downloaded
  INFO [2025-12-22 07:55:23] Will download missing datasets now
  INFO [2025-12-22 07:55:23] will download latest individual index: IND2021ER
  This can take several hours/days to download.
   want to go ahead? give me 'yes' or 'no'.
  INFO [2025-12-22 07:55:23] psidR: Loading Family data from .rda files
  INFO [2025-12-22 07:55:23] psidR: loaded individual file: /data/gannet/ripley/R/packages/tests-devel/psidR.Rcheck/psidR/testdata/IND2017ER.RData
  INFO [2025-12-22 07:55:23] psidR: total memory load in MB: 1
  INFO [2025-12-22 07:55:23] psidR: currently working on data for year 1985
  INFO [2025-12-22 07:55:23] full 1985 sample has 2000 obs
  INFO [2025-12-22 07:55:23] you selected 500 obs belonging to SRC
  INFO [2025-12-22 07:55:23] psidR: currently working on data for year 1986
  INFO [2025-12-22 07:55:23] full 1986 sample has 2000 obs
  INFO [2025-12-22 07:55:23] you selected 500 obs belonging to SRC
  Saving _problems/test_buildpanel-104.R
  [ FAIL 4 | WARN 0 | SKIP 0 | PASS 6 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test_buildpanel.R:30:5'): check balanced sample design ──────────────
  Error in ``[.data.table`(data2, , `:=`(present, length(year)), by = pid)`: attempt access index 10/10 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─psidR::build.panel(...) at test_buildpanel.R:30:5
   2.   ├─data2[, `:=`(present, length(year)), by = pid]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test_buildpanel.R:70:3'): check subsetting to head and wife sample ──
  Error in ``[.data.table`(data2, , `:=`(present, length(year)), by = pid)`: attempt access index 10/10 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─psidR::build.panel(...) at test_buildpanel.R:70:3
   2.   ├─data2[, `:=`(present, length(year)), by = pid]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test_buildpanel.R:87:3'): check subsetting to current heads only ────
  Error in ``[.data.table`(data2, , `:=`(present, length(year)), by = pid)`: attempt access index 10/10 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─psidR::build.panel(...) at test_buildpanel.R:87:3
   2.   ├─data2[, `:=`(present, length(year)), by = pid]
   3.   └─data.table:::`[.data.table`(...)
  ── Error ('test_buildpanel.R:104:3'): check subsetting to core/immigrant/latino ──
  Error in ``[.data.table`(data2, , `:=`(present, length(year)), by = pid)`: attempt access index 10/10 in VECTOR_ELT
  Backtrace:
      ▆
   1. └─psidR::build.panel(...) at test_buildpanel.R:104:3
   2.   ├─data2[, `:=`(present, length(year)), by = pid]
   3.   └─data.table:::`[.data.table`(...)
  
  [ FAIL 4 | WARN 0 | SKIP 0 | PASS 6 ]
  Error:
  ! Test failures.
  Execution halted