[R] Error when using complete function for imputed data

Paul Bernal p@ulbern@l07 @ending from gm@il@com
Mon Sep 3 16:30:22 CEST 2018


Dear friends,

It seems to me that there is something wrong with the complete function. I
am using R version 3.5.0 and mice package for data imputation.

I am working on a Windows 8.1 Enterprise machine with 64-bit Operating
System.

So here is my code:

Imputed_Data <- mice(dataFrame[2:5])
CompleteData <- complete(Imputed_Data)
Error in UseMethod("complete_") :
  no applicable method for 'complete_' applied to an object of class "mids"

I used the complete function before when imputing data with the mice
function, but now it is not working.

Any help will be greatly appreciated. Below is the dput() of my dataset:

> dput(dataFrame)
structure(list(TransitDate = structure(c(496990800, 499669200,
502261200, 504939600, 507618000, 510037200, 512715600, 515307600,
517986000, 520578000, 523256400, 525934800, 528526800, 531205200,
533797200, 536475600, 539154000, 541573200, 544251600, 546843600,
549522000, 552114000, 554792400, 557470800, 560062800, 562741200,
565333200, 568011600, 570690000, 573195600, 575874000, 578466000,
581144400, 583736400, 586414800, 589093200, 591685200, 594363600,
596955600, 599634000, 602312400, 604731600, 607410000, 610002000,
612680400, 615272400, 617950800, 620629200, 623221200, 625899600,
628491600, 631170000, 633848400, 636267600, 638946000, 641538000,
644216400, 646808400, 649486800, 652165200, 654757200, 657435600,
660027600, 662706000, 665384400, 667803600, 670482000, 673074000,
675752400, 678344400, 681022800, 683701200, 686293200, 688971600,
691563600, 694242000, 696920400, 699426000, 702104400, 704696400,
707371200, 709963200, 712641600, 715320000, 717912000, 720590400,
723182400, 725860800, 728539200, 730958400, 733636800, 736232400,
738910800, 741502800, 744181200, 746859600, 749451600, 752130000,
754722000, 757400400, 760078800, 762498000, 765176400, 767768400,
770446800, 773038800, 775717200, 778395600, 780987600, 783666000,
786258000, 788936400, 791614800, 794034000, 796712400, 799304400,
801982800, 804574800, 807253200, 809931600, 812523600, 815202000,
817794000, 820472400, 823150800, 825656400, 828334800, 830926800,
833605200, 836197200, 838875600, 841554000, 844146000, 846824400,
849416400, 852094800, 854773200, 857192400, 859870800, 862462800,
865141200, 867733200, 870411600, 873090000, 875682000, 878360400,
880952400, 883630800, 886309200, 888728400, 891406800, 893998800,
896677200, 899269200, 901947600, 904626000, 907218000, 909896400,
912488400, 915166800, 917845200, 920264400, 922942800, 925534800,
928213200, 930805200, 933483600, 936162000, 938754000, 941432400,
944024400, 946702800, 949381200, 951886800, 954565200, 957157200,
959835600, 962427600, 965106000, 967784400, 970376400, 973054800,
975646800, 978325200, 981003600, 983422800, 986101200, 988693200,
991371600, 993963600, 996642000, 999320400, 1001912400, 1004590800,
1007182800, 1009861200, 1012539600, 1014958800, 1017637200, 1020229200,
1022907600, 1025499600, 1028178000, 1030856400, 1033448400, 1036126800,
1038718800, 1041397200, 1044075600, 1046494800, 1049173200, 1051765200,
1054443600, 1057035600, 1059714000, 1062392400, 1064984400, 1067662800,
1070254800, 1072933200, 1075611600, 1078117200, 1080795600, 1083387600,
1086066000, 1088658000, 1091336400, 1094014800, 1096606800, 1099285200,
1101877200, 1104555600, 1107234000, 1109653200, 1112331600, 1114923600,
1117602000, 1120194000, 1122872400, 1125550800, 1128142800, 1130821200,
1133413200, 1136091600, 1138770000, 1141189200, 1143867600, 1146459600,
1149138000, 1151730000, 1154408400, 1157086800, 1159678800, 1162357200,
1164949200, 1167627600, 1170306000, 1172725200, 1175403600, 1177995600,
1180674000, 1183266000, 1185944400, 1188622800, 1191214800, 1193893200,
1196485200, 1199163600, 1201842000, 1204347600, 1207026000, 1209618000,
1212296400, 1214888400, 1217566800, 1220245200, 1222837200, 1225515600,
1228107600, 1230786000, 1233464400, 1235883600, 1238562000, 1241154000,
1243832400, 1246424400, 1249102800, 1251781200, 1254373200, 1257051600,
1259643600, 1262322000, 1265000400, 1267419600, 1270098000, 1272690000,
1275368400, 1277960400, 1280638800, 1283317200, 1285909200, 1288587600,
1291179600, 1293858000, 1296536400, 1298955600, 1301634000, 1304226000,
1306904400, 1309496400, 1312174800, 1314853200, 1317445200, 1320123600,
1322715600, 1325394000, 1328072400, 1330578000, 1333256400, 1335848400,
1338526800, 1341118800, 1343797200, 1346475600, 1349067600, 1351746000,
1354338000, 1357016400, 1359694800, 1362114000, 1364792400, 1367384400,
1370062800, 1372654800, 1375333200, 1378011600, 1380603600, 1383282000,
1385874000, 1388552400, 1391230800, 1393650000, 1396328400, 1398920400,
1401598800, 1404190800, 1406869200, 1409547600, 1412139600, 1414818000,
1417410000, 1420088400, 1422766800, 1425186000, 1427864400, 1430456400,
1433134800, 1435726800, 1438405200, 1441083600, 1443675600, 1446354000,
1448946000, 1451624400, 1454302800, 1456808400, 1459486800, 1462078800,
1464757200, 1467349200, 1470027600, 1472706000, 1475298000, 1477976400,
1480568400, 1483246800, 1485925200, 1488344400, 1491022800, 1493614800,
1496293200, 1501563600, 1504242000), class = c("POSIXct", "POSIXt"
), tzone = ""), Transits = c(14L, 14L, 13L, 10L, 11L, 14L, 14L,
14L, 16L, 6L, 8L, 6L, 6L, 7L, 7L, 9L, 7L, 9L, 3L, 12L, 7L, 8L,
10L, 9L, 10L, 11L, 9L, 9L, 5L, 11L, 12L, 7L, 12L, 10L, 9L, 13L,
7L, 7L, 8L, 4L, 4L, 7L, 5L, 7L, 7L, 6L, 9L, 4L, 7L, 9L, 5L, 5L,
10L, 6L, 6L, 13L, 6L, 7L, 10L, 7L, 8L, 5L, 6L, 7L, 6L, 9L, 8L,
10L, 9L, 9L, 12L, 5L, 9L, 6L, 7L, 10L, 10L, 9L, 14L, 14L, 15L,
14L, 16L, 17L, 18L, 11L, 15L, 14L, 8L, 13L, 10L, 9L, 12L, 8L,
12L, 10L, 11L, 10L, 9L, 10L, 11L, 8L, 10L, 12L, 10L, 11L, 14L,
9L, 15L, 15L, 14L, 14L, 14L, 15L, 16L, 15L, 18L, 21L, 18L, 17L,
21L, 18L, 19L, 19L, 18L, 21L, 22L, 25L, 23L, 28L, 25L, 25L, 25L,
21L, 28L, 21L, 22L, 23L, 20L, 24L, 22L, 26L, 24L, 24L, 28L, 31L,
34L, 36L, 33L, 29L, 34L, 33L, 33L, 31L, 33L, 29L, 32L, 26L, 24L,
30L, 27L, 31L, 23L, 23L, 21L, 21L, 18L, 21L, 19L, 19L, 16L, 14L,
22L, 24L, 28L, 26L, 29L, 23L, 28L, 21L, 17L, 17L, 14L, 12L, 14L,
10L, 12L, 13L, 14L, 15L, 21L, 10L, 15L, 12L, 15L, 16L, 17L, 14L,
14L, 12L, 7L, 8L, 8L, 11L, 9L, 12L, 11L, 6L, 8L, 11L, 7L, 8L,
14L, 9L, 11L, 8L, 8L, 6L, 3L, 4L, 4L, 5L, 4L, 3L, 3L, 5L, 8L,
6L, 8L, 6L, 7L, 14L, 14L, 15L, 13L, 16L, 18L, 20L, 21L, 18L,
19L, 24L, 27L, 26L, 18L, 28L, 21L, 22L, 25L, 29L, 26L, 22L, 22L,
14L, 18L, 18L, 13L, 15L, 16L, 19L, 9L, 14L, 11L, 9L, 14L, 16L,
11L, 13L, 11L, 16L, 16L, 20L, 17L, 19L, 18L, 24L, 19L, 19L, 15L,
21L, 21L, 24L, 28L, 14L, 20L, 15L, 24L, 18L, 24L, 24L, 25L, 21L,
24L, 27L, 28L, 27L, 26L, 29L, 25L, 24L, 25L, 28L, 23L, 30L, 23L,
29L, 26L, 31L, 33L, 40L, 36L, 39L, 36L, 34L, 32L, 32L, 30L, 27L,
32L, 30L, 31L, 26L, 31L, 29L, 26L, 28L, 24L, 22L, 11L, 15L, 17L,
12L, 13L, 14L, 9L, 12L, 11L, 17L, 9L, 8L, 7L, 11L, 8L, 15L, 8L,
10L, 13L, 12L, 13L, 12L, 12L, 19L, 21L, 18L, 20L, 21L, 20L, 22L,
19L, 21L, 20L, 21L, 18L, 18L, 19L, 13L, 16L, 12L, 6L, 7L, 5L,
6L, 6L, 7L, 7L, 5L, 4L, 6L, 4L, 1L, 2L, 7L, 12L), CargoTons = c(154973L,
129636L, 136884L, 86348L, 109907L, 154506L, 144083L, 152794L,
124861L, 60330L, 65221L, 61718L, 53997L, 83536L, 63218L, 98222L,
54719L, 98470L, 18263L, 104255L, 62869L, 62523L, 75344L, 81476L,
92818L, 87457L, 85231L, 77897L, 57699L, 96989L, 109361L, 59799L,
91116L, 82241L, 74251L, 124361L, 68751L, 61719L, 68017L, 37760L,
32513L, 56359L, 51333L, 80859L, 75852L, 65760L, 96043L, 38820L,
63202L, 102647L, 49104L, 53482L, 121305L, 71795L, 76704L, 146097L,
73047L, 68557L, 110642L, 77616L, 97767L, 52059L, 58658L, 66350L,
69303L, 76013L, 91909L, 108445L, 94454L, 101249L, 112131L, 56290L,
118342L, 70618L, 64783L, 112839L, 120506L, 94243L, 130768L, 133643L,
146321L, 140736L, 147234L, 158953L, 189888L, 93819L, 130021L,
130124L, 55088L, 114783L, 95184L, 82205L, 80321L, 65422L, 98933L,
93713L, 98417L, 97210L, 88464L, 94659L, 92873L, 79784L, 96655L,
122266L, 100779L, 120569L, 133029L, 92889L, 160886L, 132364L,
130435L, 139653L, 152143L, 160824L, 165842L, 175679L, 210872L,
211941L, 207820L, 179857L, 212733L, 203135L, 218368L, 198343L,
195677L, 210066L, 243311L, 261965L, 240683L, 245242L, 218004L,
247640L, 209872L, 223668L, 290521L, 185161L, 210341L, 261739L,
205431L, 284114L, 251466L, 302961L, 292981L, 279329L, 309197L,
341092L, 385209L, 366958L, 330515L, 286950L, 295590L, 350901L,
341678L, 284666L, 283148L, 279108L, 284896L, 238802L, 198786L,
273465L, 256694L, 360520L, 320201L, 296881L, 264202L, 280142L,
219105L, 278606L, 254420L, 260339L, 216457L, 198077L, 249436L,
302860L, 360184L, 317105L, 391413L, 265210L, 354714L, 306031L,
266124L, 215799L, 232630L, 156590L, 203111L, 157075L, 160140L,
177874L, 219162L, 159610L, 286483L, 144631L, 216456L, 157305L,
237780L, 191617L, 223211L, 180330L, 187074L, 126043L, 62462L,
93633L, 56417L, 115036L, 74365L, 98785L, 116172L, 43421L, 73769L,
128795L, 58910L, 74282L, 115312L, 102303L, 106109L, 76940L, 82683L,
49149L, 22517L, 20731L, 24684L, 52558L, 40057L, 28981L, 46062L,
43213L, 107755L, 53404L, 56390L, 41541L, 41183L, 80161L, 110960L,
130891L, 130395L, 183351L, 242803L, 225383L, 190962L, 169432L,
186260L, 206997L, 196097L, 202942L, 175063L, 240869L, 213226L,
237754L, 208280L, 231596L, 207033L, 213294L, 250265L, 129334L,
173986L, 145188L, 98384L, 163739L, 138180L, 136521L, 86836L,
97452L, 71988L, 79293L, 124134L, 116343L, 91030L, 98457L, 77906L,
130599L, 132381L, 162992L, 142756L, 150105L, 150339L, 161097L,
112633L, 145691L, 100771L, 147805L, 123418L, 138375L, 185776L,
108842L, 145245L, 108517L, 154079L, 118999L, 184855L, 157646L,
187000L, 126190L, 181693L, 180395L, 170781L, 200521L, 140371L,
185517L, 160662L, 149601L, 164220L, 162613L, 120102L, 189868L,
131791L, 187465L, 205760L, 249684L, 219829L, 201173L, 230138L,
261196L, 258797L, 286470L, 216719L, 219241L, 221386L, 191207L,
212000L, 220639L, 237053L, 172805L, 199395L, 154402L, 152970L,
120174L, 188452L, 122797L, 88608L, 101692L, 114182L, 96193L,
111524L, 93344L, 87006L, 104160L, 88455L, 77399L, 69451L, 73572L,
54280L, 93056L, 71274L, 124714L, 65822L, 54215L, 73492L, 73178L,
104991L, 68259L, 88045L, 84797L, 47925L, 88662L, 88082L, 140498L,
116875L, 145168L, 107149L, 144324L, 119079L, 171258L, 97017L,
86082L, 110873L, 50194L, 114805L, 62368L, 32524L, 39318L, 30558L,
42822L, 45154L, 35025L, 20565L, 58236L, 35809L, 47644L, 30747L,
NA, NA, 35449L, 48808L), RcnstPCUMS = c(229914L, 214547L, 215890L,
158695L, 173125L, 222533L, 212490L, 222125L, 266913L, 94268L,
112967L, 95480L, 87654L, 108996L, 97973L, 139247L, 93817L, 133197L,
40020L, 169749L, 102590L, 112121L, 140241L, 122989L, 144592L,
144979L, 123748L, 123249L, 70081L, 155218L, 168096L, 104743L,
163384L, 142648L, 129188L, 183170L, 99299L, 99873L, 111648L,
55890L, 59183L, 95568L, 72550L, 104562L, 100478L, 92665L, 130625L,
54786L, 105900L, 135833L, 70932L, 73247L, 149632L, 94317L, 87926L,
181989L, 92778L, 107097L, 153246L, 105175L, 126393L, 81976L,
95518L, 109019L, 95370L, 140492L, 125795L, 157978L, 138424L,
138160L, 180320L, 78757L, 135860L, 85921L, 114847L, 151965L,
152561L, 132841L, 204839L, 209567L, 224436L, 210209L, 227143L,
245968L, 264969L, 158648L, 222251L, 194335L, 111618L, 189643L,
137438L, 124953L, 163155L, 107633L, 164525L, 135102L, 152072L,
126636L, 121008L, 137824L, 149673L, 106832L, 134953L, 162195L,
135259L, 151180L, 188069L, 121234L, 199609L, 206011L, 186772L,
185596L, 189869L, 189930L, 209268L, 191993L, 238722L, 281076L,
236211L, 227651L, 277805L, 248063L, 258661L, 261644L, 248401L,
292764L, 313626L, 353877L, 318685L, 385547L, 346224L, 347058L,
353098L, 290663L, 398291L, 305578L, 314469L, 325343L, 281866L,
355524L, 323626L, 393901L, 360773L, 362326L, 415317L, 464535L,
511488L, 540671L, 491824L, 426657L, 500855L, 494717L, 495668L,
455605L, 484598L, 437629L, 476437L, 383114L, 357059L, 449471L,
409024L, 479044L, 360007L, 360455L, 333982L, 342971L, 273450L,
337258L, 308626L, 302838L, 265044L, 221514L, 341869L, 371003L,
450406L, 414775L, 469590L, 360334L, 451528L, 337465L, 283627L,
278748L, 242639L, 202808L, 237041L, 174856L, 206948L, 219398L,
247023L, 253697L, 351625L, 179661L, 255214L, 205368L, 258669L,
270376L, 284729L, 231441L, 240220L, 197141L, 110459L, 124586L,
115785L, 208191L, 139493L, 195068L, 184665L, 99351L, 123562L,
186571L, 117504L, 128846L, 217616L, 128850L, 158105L, 112762L,
118091L, 91510L, 41670L, 65418L, 57038L, 74113L, 63359L, 48717L,
59326L, 79181L, 133076L, 93478L, 121455L, 100396L, 113939L, 224357L,
209899L, 237803L, 196839L, 254633L, 278283L, 302996L, 315330L,
272767L, 277027L, 357066L, 398089L, 400740L, 275789L, 429226L,
326028L, 332848L, 388062L, 434889L, 397012L, 332171L, 338845L,
209076L, 270632L, 261217L, 191663L, 222970L, 237384L, 276674L,
138649L, 203588L, 178863L, 135641L, 217348L, 239162L, 168607L,
196393L, 173731L, 256877L, 250192L, 303120L, 256045L, 278352L,
266185L, 350521L, 282258L, 281162L, 226240L, 312103L, 312547L,
369650L, 420464L, 214503L, 305474L, 232981L, 382171L, 291030L,
370213L, 368859L, 395471L, 331912L, 389084L, 433543L, 446459L,
434882L, 427397L, 482135L, 424532L, 402021L, 413143L, 460258L,
399300L, 513805L, 383895L, 485673L, 426859L, 515510L, 532852L,
640559L, 591249L, 612067L, 577562L, 546291L, 524853L, 515396L,
485261L, 442432L, 520541L, 485585L, 505058L, 424639L, 527199L,
468619L, 427842L, 457937L, 414473L, 368965L, 165326L, 228879L,
261042L, 184066L, 199600L, 213524L, 140264L, 175064L, 152734L,
252011L, 139741L, 124736L, 106170L, 165564L, 127610L, 237950L,
122876L, 151239L, 191794L, 173043L, 187453L, 171653L, 171397L,
275756L, 308794L, 264032L, 285570L, 322867L, 281804L, 311683L,
271705L, 310707L, 286221L, 302599L, 270895L, 258684L, 277845L,
191935L, 236936L, 180781L, 101623L, 112534L, 81747L, 98125L,
102205L, 111226L, 110349L, 89677L, 69492L, 97820L, 69730L, 15018L,
40889L, 97624L, 166204L), TotalToll = c(420742L, 392621L, 395078L,
290411L, 316818L, 407235L, 388856L, 406488L, 482774L, 172510L,
206729L, 174728L, 160406L, 199462L, 179290L, 254822L, 171685L,
243750L, 73236L, 310640L, 187739L, 205181L, 249438L, 225069L,
264603L, 265311L, 226458L, 225545L, 128248L, 284048L, 296023L,
184934L, 298992L, 261045L, 236414L, 335201L, 181717L, 182767L,
204315L, 102278L, 108304L, 174889L, 132766L, 191348L, 183874L,
169576L, 239043L, 100258L, 212859L, 273024L, 142573L, 147226L,
300760L, 189577L, 176731L, 365797L, 186483L, 215264L, 308024L,
211401L, 254049L, 164771L, 191991L, 219128L, 191693L, 282388L,
252847L, 317535L, 278232L, 277701L, 356022L, 158301L, 273078L,
172701L, 230842L, 305449L, 306647L, 267010L, 406202L, 421229L,
451116L, 422520L, 456557L, 494395L, 582202L, 350612L, 491174L,
429480L, 239858L, 419111L, 303737L, 276146L, 360572L, 237868L,
358627L, 298575L, 336079L, 279865L, 267427L, 304591L, 323566L,
236098L, 298246L, 358450L, 298922L, 334107L, 415632L, 267927L,
441136L, 455284L, 412766L, 410167L, 419610L, 419745L, 462482L,
424305L, 527576L, 621178L, 522026L, 503109L, 613949L, 548219L,
571641L, 578233L, 548966L, 647008L, 693113L, 782068L, 704294L,
845344L, 765155L, 766998L, 774306L, 642365L, 880223L, 730331L,
751581L, 770694L, 660018L, 849702L, 773466L, 941423L, 862247L,
865959L, 992608L, 1103240L, 1222456L, 1389524L, 1263988L, 1096508L,
1278566L, 1271423L, 1273867L, 1158103L, 1239499L, 1124707L, 1218525L,
984603L, 909630L, 1155140L, 1043122L, 1231143L, 925218L, 926369L,
850265L, 881435L, 702766L, 866753L, 793169L, 778294L, 681163L,
569291L, 871709L, 953478L, 1150022L, 1065972L, 1206846L, 926058L,
1129778L, 867285L, 728921L, 716382L, 623582L, 521217L, 609195L,
449380L, 531856L, 563853L, 634849L, 643607L, 888831L, 461729L,
655900L, 527796L, 664779L, 687175L, 731754L, 586409L, 617365L,
506652L, 276310L, 320186L, 289618L, 535051L, 389544L, 544553L,
515428L, 277302L, 336755L, 512700L, 318225L, 359684L, 607673L,
379065L, 465104L, 331810L, 347203L, 268918L, 122643L, 192034L,
159071L, 217928L, 186080L, 134668L, 173724L, 232564L, 390599L,
265947L, 348773L, 294627L, 334562L, 649731L, 607805L, 698507L,
578572L, 1059450L, 1187844L, 1246619L, 1296120L, 1140384L, 1187214L,
1432452L, 1606332L, 1728174L, 1203594L, 1822716L, 1389276L, 1728426L,
1926935L, 2125297L, 1943820L, 1623321L, 1590148L, 1049286L, 1398754L,
1320550L, 994945L, 1164583L, 1205841L, 1559682L, 769662L, 1091567L,
1000642L, 718794L, 1175818L, 1254971L, 900558L, 1033592L, 927072L,
1245348L, 1240380L, 1820813L, 1567994L, 1789477L, 1700773L, 2204080L,
1745881L, 1842826L, 1476216L, 1967969L, 1939304L, 2335284L, 2676920L,
1580544L, 2277360L, 1694016L, 2721614L, 2107008L, 2630707L, 2530555L,
2872656L, 2395440L, 2704234L, 3035837L, 3147379L, 3076661L, 2903544L,
3398155L, 2964859L, 2837506L, 2883096L, 3264696L, 2779186L, 3980670L,
2923166L, 3739659L, 3317358L, 3978904L, 4112544L, 4828331L, 4423260L,
4650546L, 4321198L, 4147356L, 3959882L, 3891892L, 3623148L, 3365086L,
3917517L, 3708696L, 3876444L, 3234706L, 3968716L, 3558025L, 3313506L,
3522721L, 3104372L, 2772710L, 1329618L, 1857286L, 2126974L, 1509160L,
1616068L, 1679704L, 1164638L, 1390846L, 1199265L, 1868727L, 1091024L,
1023810L, 837614L, 1367468L, 1056694L, 1886631L, 951129L, 1153342L,
1491752L, 1305802L, 1461332L, 1286770L, 1310026L, 1997167L, 2234964L,
1924902L, 2080596L, 2331026L, 2046594L, 2302530L, 1958478L, 2262478L,
2115387L, 2220923L, 1959669L, 1849238L, 2089172L, 1381704L, 1553856L,
1251361L, 704230L, 776554L, 592426L, 704066L, 772042L, 754649L,
797425L, 624502L, 517122L, 683626L, 507750L, 99592L, 217680L,
671070L, 1150758L)), class = "data.frame", row.names = c(NA,
383L))

	[[alternative HTML version deleted]]



More information about the R-help mailing list