Roll call object

Hello,
I am using the pscl package to create a roll call object, but I am finding an error, and couldn't overcome it.

The command I used is the following:

rollcall(data=mydata_rollcall$voto,
         legis.names = mydata_rollcall$deputado_id,
         legis.data=mydata_rollcall$government,
         vote.names = mydata_rollcall$ï..idVotacao,
         vote.data=mydata_rollcall$data)

It returns:

supplied legislator names do not match number of rows
in roll call matrix; will use default names
supplied vote names do not match number of columns
in roll call matrix; will use default names
Error in if (nrow(legis.data) != nrow(v)) stop("legislator data does not match number of legislators in roll call matrix") else rownames(legis.data) <- nm :
argument is of length zero

But there is no NA in any row, and the number of legislators and votes are the same.

Here is the data I am using:

mydata_rollcall<-data.frame(
  stringsAsFactors = FALSE,
              voto = c("0","0","0","0","1","0",
                       "1","1","1","0","1","1","1","1","0"),
       deputado_id = c(204554L,204560L,204528L,
                       121948L,160508L,136811L,178835L,178836L,160559L,204545L,
                       204501L,178972L,204571L,204544L,160545L),
        government = c("1","0","0","1","0","1",
                       "0","1","1","1","0","0","0","0","1"),
      ï..idVotacao = c("2263410-69","2263410-69",
                       "2263410-69","2263410-69","2263410-69","2263410-69",
                       "2263410-69","2263410-69","2263410-69","2263410-69",
                       "2263410-69","2263410-69","2263410-69","2263410-69",
                       "2263410-69"),
              data = c("2020-12-18","2020-12-18",
                       "2020-12-18","2020-12-18","2020-12-18","2020-12-18",
                       "2020-12-18","2020-12-18","2020-12-18","2020-12-18",
                       "2020-12-18","2020-12-18","2020-12-18","2020-12-18",
                       "2020-12-18")
)

I appreciate your help.

See the help(rollcall) example and compare its data layout to yours

library(pscl)
#> Classes and Methods for R developed in the
#> Political Science Computational Laboratory
#> Department of Political Science
#> Stanford University
#> Simon Jackman
#> hurdle and zeroinfl functions by Achim Zeileis
data(sc9497)             ## Supreme Court example data
rc <- rollcall(data=sc9497$votes,
               legis.names=sc9497$legis.names,
               desc=sc9497$desc)
                     
sc9497$votes |> head()
#>           Vote 1 Vote 2 Vote 3 Vote 4 Vote 5 Vote 6 Vote 7 Vote 8 Vote 9
#> Rehnquist      1      0      1      1      0      1      1      1      1
#> Stevens        0      1      1      0      1      0      0      0      0
#> O'Connor       1      0      1      1      0      1      1      1      0
#> Scalia         1      0      0      1      1      1      1      1     NA
#> Kennedy        1      1      1      1      1      1      1      1      1
#> Souter         1      1      1      1      1      1      1      0      1
#>           Vote 10 Vote 11 Vote 12 Vote 13 Vote 14 Vote 15 Vote 16 Vote 17
#> Rehnquist       1       0       1       1       0       0       1       1
#> Stevens         1       1       0       1       1       1       0       1
#> O'Connor        1       1       1       0       1       1       1       0
#> Scalia          0       0       1       1       0       0       1       1
#> Kennedy         1       0       1       1       1       1       1       1
#> Souter          1       1       1       1       1       1       1       1
#>           Vote 18 Vote 19 Vote 20 Vote 21 Vote 22 Vote 23 Vote 24 Vote 25
#> Rehnquist       1       1       1       1       1       1       1       1
#> Stevens         1       0       1       1       1       0       0       0
#> O'Connor        1       1       1       0       0       1       1       1
#> Scalia          0       1       1       0       1       1       1       1
#> Kennedy         1       1       1       1       1       1       1       1
#> Souter          1       1       1       0       1       1       1       1
#>           Vote 26 Vote 27 Vote 28 Vote 29 Vote 30 Vote 31 Vote 32 Vote 33
#> Rehnquist       0       1       0       1       0       1       0       1
#> Stevens         1       1       1       0       1       0       1       1
#> O'Connor        1       0       1       1       1       1       0       1
#> Scalia          0       1       0       1       1       1       1       0
#> Kennedy         1       1       0       1       0       1       1       0
#> Souter          1       0       1       0       1       0       0       1
#>           Vote 34 Vote 35 Vote 36 Vote 37 Vote 38 Vote 39 Vote 40 Vote 41
#> Rehnquist       1       0       1       0       1       1       1       1
#> Stevens         0       1       1       1       0       0       0       0
#> O'Connor        1       0       1       1       1       1       1       1
#> Scalia          1       0       1       1       1       1       1       1
#> Kennedy         1       1       1       1       1       1       1       1
#> Souter          1       1       1       1       1       0       0       1
#>           Vote 42 Vote 43 Vote 44 Vote 45 Vote 46 Vote 47 Vote 48 Vote 49
#> Rehnquist       1       1       0       1       1       1       1       1
#> Stevens         1       0       1       0       0       0       1       0
#> O'Connor        0       1       1       0       1       1       1       1
#> Scalia          1       1       0       1       1       1       0       1
#> Kennedy         1       1       1       1       1       1       0       0
#> Souter          0       1       0       0       0       1       1       0
#>           Vote 50 Vote 51 Vote 52 Vote 53 Vote 54 Vote 55 Vote 56 Vote 57
#> Rehnquist       1       0       1       1       1       1       1       1
#> Stevens         0       1       0       0       0       0       0       0
#> O'Connor        0       1       1       1       1       1       1       1
#> Scalia          1       0       1       1       1       1       1       1
#> Kennedy         1       1       1       1       1       1       1       1
#> Souter          0       1       1       0       0       1       1       0
#>           Vote 58 Vote 59 Vote 60 Vote 61 Vote 62 Vote 63 Vote 64 Vote 65
#> Rehnquist       1       1       1       0       1       0       1       1
#> Stevens         0       1       1       1       1       1       0       0
#> O'Connor        1       1       1       1       1       1       1       1
#> Scalia          1       1       0       1       0       0       1       1
#> Kennedy         1       1       1       1       1       1       1       1
#> Souter          1       1       1       1       1       1       1       1
#>           Vote 66 Vote 67 Vote 68 Vote 69 Vote 70 Vote 71 Vote 72 Vote 73
#> Rehnquist       1       1       0       1       1       1       1       1
#> Stevens         0       0       1       0       0      NA       0       1
#> O'Connor        1       1       1       1       1       0       1       0
#> Scalia          1       1       0       1       1       1       1       0
#> Kennedy         1       1       0       1       1       1       0       1
#> Souter          1       1       1       1       0       1       0       1
#>           Vote 74 Vote 75 Vote 76 Vote 77 Vote 78 Vote 79 Vote 80 Vote 81
#> Rehnquist       1       0       0       1       1       0       1       1
#> Stevens         0       1       1       0       0       1       0       0
#> O'Connor        1       1       1       1       1       0       1       1
#> Scalia          1       0       0       1       1       0       1       1
#> Kennedy         1       0       0       1       1       1       0       1
#> Souter          0       1       1       1       0       1       1       1
#>           Vote 82 Vote 83 Vote 84 Vote 85 Vote 86 Vote 87 Vote 88 Vote 89
#> Rehnquist       0       0       0       1       1       1       1       1
#> Stevens         1       1       1       1       1      NA       0       0
#> O'Connor        1       1       0       1       1       1       1       1
#> Scalia          0       0       1       1       0       1       1       1
#> Kennedy         1       1       1       1       1       0       1       1
#> Souter          1       1       1       1       1       1       0       0
#>           Vote 90 Vote 91 Vote 92 Vote 93 Vote 94 Vote 95 Vote 96 Vote 97
#> Rehnquist       0       1       1       1       1       1       1       1
#> Stevens         1       0       0       1       0       0       0       0
#> O'Connor        1       0       1       0       1       1       1       1
#> Scalia          0       1       1       1       1       1       1       1
#> Kennedy         1       1       1       1       1       1       1       1
#> Souter          1       0       0       1       0       1       1       1
#>           Vote 98 Vote 99 Vote 100 Vote 101 Vote 102 Vote 103 Vote 104 Vote 105
#> Rehnquist       1       1        0        0        1        1        1        1
#> Stevens         0       0        1        1        1        0        1        1
#> O'Connor        1       1        1        0        1        1        1        1
#> Scalia          1       1        0        0        0        1        0        0
#> Kennedy         1       1        1        1        1        1        1        1
#> Souter          1       1        1        1        1        1        1        1
#>           Vote 106 Vote 107 Vote 108 Vote 109 Vote 110 Vote 111 Vote 112
#> Rehnquist        1        0        1        0        1        1        1
#> Stevens          1        1        0        1        0        1        0
#> O'Connor         1        1        1        1        1        0        1
#> Scalia           1        1        1        1        1        0        1
#> Kennedy          0        1        1        1        1        1        1
#> Souter           1        1        1        1        1        1        1
#>           Vote 113 Vote 114 Vote 115 Vote 116 Vote 117 Vote 118 Vote 119
#> Rehnquist        1        1        1        0        1        0        1
#> Stevens          0        0        1        1        0        1        0
#> O'Connor         1        1        0        1        1        0        1
#> Scalia           1        1        0        0        1        0        1
#> Kennedy          1        1        1        1        0        1        1
#> Souter           1        1        1        1        1        1        1
#>           Vote 120 Vote 121 Vote 122 Vote 123 Vote 124 Vote 125 Vote 126
#> Rehnquist        1        1        1        1        1        1        1
#> Stevens          0        1        0        0        0        1        1
#> O'Connor         1        1        1        1        1        1        1
#> Scalia           1        0        1        1        1        0        0
#> Kennedy          1        0        0        1        1        1        0
#> Souter           1        1        1        1        1        1        1
#>           Vote 127 Vote 128 Vote 129 Vote 130 Vote 131 Vote 132 Vote 133
#> Rehnquist        1        1        0        1        1        1        1
#> Stevens          1        0        1        0        0        0        0
#> O'Connor         0        1        1        1        1        1        0
#> Scalia           0        1        1        1        1        1        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           1        1        1        0        0        0        1
#>           Vote 134 Vote 135 Vote 136 Vote 137 Vote 138 Vote 139 Vote 140
#> Rehnquist        1        1        0        1        1        0        1
#> Stevens          0        0        1        0        0        1        1
#> O'Connor         1        1        1        1        1        0        0
#> Scalia           1        1        0        1        1        1        0
#> Kennedy          1        1        1        1        1        1        1
#> Souter           1        1        1        1        0        1        1
#>           Vote 141 Vote 142 Vote 143 Vote 144 Vote 145 Vote 146 Vote 147
#> Rehnquist        0       NA        1        0        1        1        1
#> Stevens          1        0        0        1        0        1        0
#> O'Connor         1        1        1        1        1        0        1
#> Scalia           1        1        1        0        1        0        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           1        1        1        1        0        1        0
#>           Vote 148 Vote 149 Vote 150 Vote 151 Vote 152 Vote 153 Vote 154
#> Rehnquist        1        1        0        1        0        1        0
#> Stevens          0        0        1        0        1        0        1
#> O'Connor         1        1        1        1        1        1        1
#> Scalia           1        1        0        1        0        1        0
#> Kennedy          1        1        0        1        0        1        1
#> Souter           0        0        1        0        1        1        0
#>           Vote 155 Vote 156 Vote 157 Vote 158 Vote 159 Vote 160 Vote 161
#> Rehnquist        1        1        1        0        1        1        1
#> Stevens          1        1        0        1        0        0        0
#> O'Connor         0        0       NA        1        1        1        1
#> Scalia           1        0        1        0        1        1        1
#> Kennedy          1        0        1        1        1        1        1
#> Souter           0        1        1        1        1        0        1
#>           Vote 162 Vote 163 Vote 164 Vote 165 Vote 166 Vote 167 Vote 168
#> Rehnquist        1        1        1        1        0        1        0
#> Stevens          0        1        0        0        1        0        1
#> O'Connor         1        1        1        1        1        1        1
#> Scalia           1        1        1        1        1        1        1
#> Kennedy          1        1        1        1        0        1        0
#> Souter           1        0        1        1        0        1        1
#>           Vote 169 Vote 170 Vote 171 Vote 172 Vote 173 Vote 174 Vote 175
#> Rehnquist        1        1        0        1        1        1        1
#> Stevens          0        0        1        0        1        0        0
#> O'Connor         1        1        1        1        0        0        1
#> Scalia           1        1        0        1        0        1        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           0        1        1        1        1        0        1
#>           Vote 176 Vote 177 Vote 178 Vote 179 Vote 180 Vote 181 Vote 182
#> Rehnquist        1        0        1        1        1        1        1
#> Stevens          1        1        0        0        0        0        1
#> O'Connor         1        1        1        1        1        1        1
#> Scalia           1        0        1        0        1        1        0
#> Kennedy          0        0        1        1        1        1        1
#> Souter           1        1        1        0        1        1        1
#>           Vote 183 Vote 184 Vote 185 Vote 186 Vote 187 Vote 188 Vote 189
#> Rehnquist        1        1        0        1        1        1        1
#> Stevens          1        0        1        1        1        0        0
#> O'Connor         1        1        0        1        1        1        1
#> Scalia           1        1        0        0        0        1        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           0        0        1        1        1        0        1
#>           Vote 190 Vote 191 Vote 192 Vote 193 Vote 194 Vote 195 Vote 196
#> Rehnquist        1        1        1        1        0        1        1
#> Stevens          0        0        1        0        1        0        0
#> O'Connor         1        1        0        1        1        1        1
#> Scalia           0        1        0        1        0        1        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           1        1        1        1        0        1        1
#>           Vote 197 Vote 198 Vote 199 Vote 200 Vote 201 Vote 202 Vote 203
#> Rehnquist        1        0        1        0        1        1        0
#> Stevens          0        1        0        1        0        1        1
#> O'Connor         1        1       NA        0        1        1        0
#> Scalia           1        0        1        0        1        0        0
#> Kennedy          1        1        1        1        1        1        0
#> Souter           0        1        1        1        0        0        1
#>           Vote 204 Vote 205 Vote 206 Vote 207 Vote 208 Vote 209 Vote 210
#> Rehnquist        1        1        1        1        1        0        1
#> Stevens          0        1        1        0        1        1        1
#> O'Connor         1        0        0        1        1        0        1
#> Scalia           1        0        0        1        1        0        1
#> Kennedy          1        1        1        1        1        1        1
#> Souter           0        1        1        0        0        1        1
#>           Vote 211 Vote 212 Vote 213
#> Rehnquist        1        1        1
#> Stevens          0        1        1
#> O'Connor         1        1        1
#> Scalia           0        0        0
#> Kennedy          1        1        1
#> Souter           0        1        1
sc9497$legis.names |> head()
#> [1] "Rehnquist" "Stevens"   "O'Connor"  "Scalia"    "Kennedy"   "Souter"
sc9497$desc |> head()
#> [1] "United States Supreme Court Decisions, 1994-1997"

Created on 2023-09-19 with reprex v2.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.