Running examples in 'medicalcoder-Ex.R' failed
The error most likely occurred in:

> ### Name: comorbidities
> ### Title: Comorbidities
> ### Aliases: comorbidities
> 
> ### ** Examples
> 
> pccc_v3.1_results <-
+   comorbidities(data = mdcr,
+                 icd.codes = "code",
+                 id.vars = "patid",
+                 dx.var = "dx",
+                 method = "pccc_v3.1",
+                 flag.method = 'current',
+                 poa = 1)
> summary(pccc_v3.1_results)
         condition                                   label dxpr_or_tech_count
1  congeni_genetic      Other Congenital or Genetic Defect               3225
2              cvd                          Cardiovascular               5147
3               gi                        Gastrointestinal               5652
4      hemato_immu              Hematologic or Immunologic               2832
5       malignancy                              Malignancy               3784
6        metabolic                               Metabolic               3407
7             misc Miscellaneous, Not Elsewhere Classified                764
8         neonatal                    Premature & Neonatal               1516
9        neuromusc             Neurologic or Neuromuscular               5828
10           renal                          Renal Urologic               2787
11     respiratory                             Respiratory               3260
12    any_tech_dep               Any Technology Dependence               7012
13  any_transplant                     Any Transplantation               1585
14       cmrb_flag                           Any Condition              20871
15        num_cmrb                         >= 2 conditions              10657
16        num_cmrb                         >= 3 conditions               4582
17        num_cmrb                         >= 4 conditions               1571
18        num_cmrb                         >= 5 conditions                418
19        num_cmrb                         >= 6 conditions                 88
20        num_cmrb                         >= 7 conditions                 13
21        num_cmrb                         >= 8 conditions                  2
22        num_cmrb                         >= 9 conditions                  0
23        num_cmrb                        >= 10 conditions                  0
24        num_cmrb                        >= 11 conditions                  0
   dxpr_or_tech_percent dxpr_only_count dxpr_only_percent tech_only_count
1           8.428728242            3225         8.4287282               0
2          13.451988919            4560        11.9178297             283
3          14.771836287            1420         3.7112540            3855
4           7.401599498            2832         7.4015995               0
5           9.889707804            3784         9.8897078               0
6           8.904396006            3356         8.7711045              40
7           1.996759187             121         0.3162407             643
8           3.962155664            1516         3.9621557               0
9          15.231822696            4564        11.9282839             316
10          7.283989337            1876         4.9030370             555
11          8.520202812            1848         4.8298573             755
12         18.326276724              NA                NA              NA
13          4.142491245              NA                NA              NA
14         54.547592912              NA                NA              NA
15         27.852699807              NA                NA              NA
16         11.975328002              NA                NA              NA
17          4.105901417              NA                NA              NA
18          1.092467723              NA                NA              NA
19          0.229993205              NA                NA              NA
20          0.033976269              NA                NA              NA
21          0.005227118              NA                NA              NA
22          0.000000000              NA                NA              NA
23          0.000000000              NA                NA              NA
24          0.000000000              NA                NA              NA
   tech_only_percent dxpr_and_tech_count dxpr_and_tech_percent
1          0.0000000                   0            0.00000000
2          0.7396372                 304            0.79452198
3         10.0752705                 377            0.98531180
4          0.0000000                   0            0.00000000
5          0.0000000                   0            0.00000000
6          0.1045424                  11            0.02874915
7          1.6805185                   0            0.00000000
8          0.0000000                   0            0.00000000
9          0.8258847                 948            2.47765407
10         1.4505253                 356            0.93042706
11         1.9732372                 657            1.71710836
12                NA                  NA                    NA
13                NA                  NA                    NA
14                NA                  NA                    NA
15                NA                  NA                    NA
16                NA                  NA                    NA
17                NA                  NA                    NA
18                NA                  NA                    NA
19                NA                  NA                    NA
20                NA                  NA                    NA
21                NA                  NA                    NA
22                NA                  NA                    NA
23                NA                  NA                    NA
24                NA                  NA                    NA
> 
> pccc_v3.1_subcondition_results <-
+   comorbidities(data = mdcr,
+                 icd.codes = "code",
+                 id.vars = "patid",
+                 dx.var = "dx",
+                 method = "pccc_v3.1",
+                 flag.method = 'current',
+                 poa = 1,
+                 subconditions = TRUE)
> summary(pccc_v3.1_subcondition_results)
         condition                                subcondition count
1  congeni_genetic                                        <NA>  3225
2  congeni_genetic                    bone_and_joint_anomalies   825
3  congeni_genetic                       chromosomal_anomalies  1544
4  congeni_genetic      diaphragm_and_abdominal_wall_anomalies   300
5  congeni_genetic                  other_congenital_anomalies   754
6              cvd                                        <NA>  5147
7              cvd                            cardiomyopathies   240
8              cvd                         conduction_disorder   653
9              cvd                   device_and_technology_use   587
10             cvd                                dysrhythmias  1130
11             cvd                        endocardium_diseases   278
12             cvd        heart_and_great_vessel_malformations  2320
13             cvd                                       other  1247
14             cvd                             transplantation   271
15              gi                                        <NA>  5652
16              gi         chronic_liver_disease_and_cirrhosis   290
17              gi                        congenital_anomalies   709
18              gi                   device_and_technology_use  4232
19              gi                  inflammatory_bowel_disease   264
20              gi                                       other   295
21              gi                             transplantation   343
22     hemato_immu                                        <NA>  2832
23     hemato_immu                   acquired_immunodeficiency    11
24     hemato_immu                            aplastic_anemias   823
25     hemato_immu                     coagulation_hemorrhagic   100
26     hemato_immu       diffuse_diseases_of_connective_tissue   125
27     hemato_immu                    hemophagocytic_syndromes    59
28     hemato_immu                          hereditary_anemias   771
29     hemato_immu                 hereditary_immunodeficiency   909
30     hemato_immu                                  leukopenia    28
31     hemato_immu                                       other    12
32     hemato_immu polyarteritis_nodosa_and_related_conditions    46
33     hemato_immu                                 sarcoidosis     3
34     hemato_immu                             transplantation   181
35      malignancy                                        <NA>  3784
36      malignancy                                   neoplasms  3525
37      malignancy                             transplantation   452
38       metabolic                                        <NA>  3407
39       metabolic                       amino_acid_metabolism   194
40       metabolic                     carbohydrate_metabolism   130
41       metabolic                   device_and_technology_use    51
42       metabolic                         endocrine_disorders   884
43       metabolic                            lipid_metabolism   354
44       metabolic                   other_metabolic_disorders  1870
45       metabolic                           storage_disorders    82
46            misc                                        <NA>   764
47            misc                   device_and_technology_use   643
48            misc                             transplantation   121
49        neonatal                                        <NA>  1516
50        neonatal                              birth_asphyxia    11
51        neonatal                cerebral_hemorrhage_at_birth    84
52        neonatal                          extreme_immaturity   349
53        neonatal                          fetal_malnutrition    45
54        neonatal             hypoxic_ischemic_encephalopathy   130
55        neonatal                                       other   247
56        neonatal                        respiratory_diseases   950
57        neonatal                 spinal_cord_injury_at_birth     0
58       neuromusc                                        <NA>  5828
59       neuromusc         brain_and_spinal_cord_malformations  1767
60       neuromusc               cns_degeneration_and_diseases  1474
61       neuromusc                   device_and_technology_use  1264
62       neuromusc                                    epilepsy   833
63       neuromusc                    infantile_cerebral_palsy  1322
64       neuromusc                   intellectual_disabilities   161
65       neuromusc                           movement_diseases   146
66       neuromusc         muscular_dystrophies_and_myopathies   147
67       neuromusc              occlusion_of_cerebral_arteries    92
68       neuromusc                  other_neurologic_disorders   848
69           renal                                        <NA>  2787
70           renal                    chronic_bladder_diseases   519
71           renal                       chronic_renal_failure   627
72           renal                        congenital_anomalies   915
73           renal                   device_and_technology_use   911
74           renal                                       other   217
75           renal                             transplantation   322
76     respiratory                                        <NA>  3260
77     respiratory                chronic_respiratory_diseases  1092
78     respiratory                             cystic_fibrosis   400
79     respiratory                   device_and_technology_use  1412
80     respiratory                                       other    22
81     respiratory                   respiratory_malformations  1091
82     respiratory                             transplantation    39
   percent_of_cohort percent_of_those_with_condition
1        8.428728242                              NA
2        2.156186294                      25.5813953
3        4.035335320                      47.8759690
4        0.784067743                       9.3023256
5        1.970623595                      23.3798450
6       13.451988919                              NA
7        0.627254195                       4.6629104
8        1.706654122                      12.6870021
9        1.534159218                      11.4047018
10       2.953321834                      21.9545366
11       0.726569442                       5.4012046
12       6.063457216                      45.0748009
13       3.259108254                      24.2277055
14       0.708274528                       5.2652030
15      14.771836287                              NA
16       0.757932152                       5.1309271
17       1.853013434                      12.5442321
18      11.060582301                      74.8761500
19       0.689979614                       4.6709130
20       0.770999948                       5.2193914
21       0.896450787                       6.0686483
22       7.401599498                              NA
23       0.028749151                       0.3884181
24       2.150959176                      29.0607345
25       0.261355914                       3.5310734
26       0.326694893                       4.4138418
27       0.154199990                       2.0833333
28       2.015054101                      27.2245763
29       2.375725263                      32.0974576
30       0.073179656                       0.9887006
31       0.031362710                       0.4237288
32       0.120223721                       1.6242938
33       0.007840677                       0.1059322
34       0.473054205                       6.3912429
35       9.889707804                              NA
36       9.212795986                      93.1553911
37       1.181328733                      11.9450317
38       8.904396006                              NA
39       0.507030474                       5.6941591
40       0.339762689                       3.8156736
41       0.133291516                       1.4969181
42       2.310386284                      25.9465806
43       0.925199937                      10.3903728
44       4.887355601                      54.8869974
45       0.214311850                       2.4068095
46       1.996759187                              NA
47       1.680518530                      84.1623037
48       0.316240657                      15.8376963
49       3.962155664                              NA
50       0.028749151                       0.7255937
51       0.219538968                       5.5408971
52       0.912132142                      23.0211082
53       0.117610162                       2.9683377
54       0.339762689                       8.5751979
55       0.645549109                      16.2928760
56       2.482881188                      62.6649077
57       0.000000000                              NA
58      15.231822696                              NA
59       4.618159009                      30.3191489
60       3.852386179                      25.2916953
61       3.303538759                      21.6884008
62       2.177094768                      14.2930679
63       3.455125189                      22.6835964
64       0.420783022                       2.7625257
65       0.381579635                       2.5051476
66       0.384193194                       2.5223061
67       0.240447441                       1.5785861
68       2.216298155                      14.5504461
69       7.283989337                              NA
70       1.356437196                      18.6221744
71       1.638701584                      22.4973089
72       2.391406618                      32.8310011
73       2.380952381                      32.6874776
74       0.567142334                       7.7861500
75       0.841566045                      11.5536419
76       8.520202812                              NA
77       2.854006586                      33.4969325
78       1.045423658                      12.2699387
79       3.690345513                      43.3128834
80       0.057498301                       0.6748466
81       2.851393027                      33.4662577
82       0.101928807                       1.1963190
> 
> charlson_results <-
+   comorbidities(data = mdcr,
+                 icd.codes = "code",
+                 id.vars = "patid",
+                 dx.var = "dx",
+                 method = "charlson_quan2011",
+                 flag.method = 'current',
+                 poa = 1)
Warning: Assuming all codes provided are secondary diagnostic codes.  Define `primarydx.var` or `primarydx` if this assumption is incorrect.
> summary(charlson_results)
Error in as.data.frame.integer(x[[i]], optional = TRUE) : 
  row names contain missing values
Calls: summary ... data.frame -> as.data.frame -> as.data.frame.integer
Execution halted