Comments (11)
This seems to suggest something is wrong with the legislator ID values. Could some of them be NA
? If you can find the specific commit where it breaks, that would definitely be helpful.
from dwnominate.
No, that isn't really possible. I have however made another very strange observation: If I restart the interactive R after the calculation fails (while saving my workspace) and then retry the same dwnominate
call again, then it works. This is all very mysterious...
from dwnominate.
I'm pretty baffled by that, so I need more info to figure this out. What was the old version you tried? If you can make a reproducible example-- maybe you can make the error occur with only a small subset of your data-- that would be really helpful.
from dwnominate.
Actually it seems like I have the same problem with older versions of dwnominate
. So far the only workaround I have found is to restart R, which seems very weird.
from dwnominate.
OK, I will try to narrow the problem down. Just in case you have any more ideas, I read my data into R from a relational database and then create the rollcall objects like this for the sessions:
l <- list()
for (i in unique(v$Session)) {
session_v <- filter(v, Session == i)
# Wide Form
session_v_pivot <- session_v %>%
mutate(ID = paste0(LastName, " (", ParlGroupAbbreviation, "/", CantonAbbreviation, ")" )) %>%
select(ID, PersonNumber, ParlGroupAbbreviation, party, IdVote, Decision) %>%
mutate(Decision_new = case_when(
Decision == 1 ~ 1,
Decision == 2 ~ 6,
!Decision %in% c(1, 2) ~ 9
)
) %>%
select(-Decision) %>%
pivot_wider(names_from = IdVote, values_from = Decision_new)
# Generate rcObject
l[[length(l) + 1]] <- rollcall(
data = session_v_pivot %>% select(-(1:4)),
yea = c(1),
nay = c(6),
missing = c(9),
notInLegis = NA,
legis.names = session_v_pivot$ID,
vote.names = names(session_v_pivot %>% select(-(1:4))),
legis.data = session_v_pivot %>% select(1:4),
)
}
res <- dwnominate::dwnominate(l)
from dwnominate.
I have attached my test data here: test.zip
To test:
- Unzip file containing
test.rds
. - Start interactive R and run following commands:
library(pscl)
library(dplyr)
library(tidyr)
library(wnominate)
- Load
test.rds
intov
:v <- readRDS('/path/to/test.rds')
- Run code from previous comment, which in my case provokes the error.
- Optionally restart R (saving workspace) and rerun last statement only.
from dwnominate.
I wasn't expecting people to put tibbles into the rollcall objects. That was the issue. Does the new version fix it for you?
from dwnominate.
Unfortunately I still have the same problem with the latest HEAD. I will try to see if I can figure out a workaround on my end.
from dwnominate.
What does the trick is to also convert the legis.data
parameter to rollcall()
using as.data.frame()
. Possibly dwnominate
could somehow do this or report a more comprehensible error message if it detects this issue.
from dwnominate.
Yup, that's what I did. 7ccb8b0
(There's a separate issue if your list only has two rollcalls, but I assume your real data has more sessions.)
from dwnominate.
Maybe I have to test it again, but I am quite certain that I still had the same problem with your fix in place and I had to add the as.data.frame()
call on top of that in my code. So possibly there is another usage of the parameter which requires this.
from dwnominate.
Related Issues (20)
- Major Error 20 HOT 1
- Fortran errors aren't passed to R HOT 3
- Weights Parameter Output HOT 4
- Need more explanation of starting estimates
- Build broken on Windows HOT 12
- No license for DW-NOMINATE.FOR HOT 1
- Installation fails on Mac (gfortran problem) HOT 3
- Problem with polarity HOT 1
- Issue with installation HOT 2
- Rewrite DW-NOMINATE in R HOT 2
- FAQ disappeared from the website
- Remove extra lapack dependency on Windows
- BLAS/LAPACK routine 'DSYEV DORGLQRowwiseD' gave error code -5
- Running dwnominate on the Swedish parliament HOT 2
- DW-NOMINATE includes proprietary IMSL code
- Segfault with more than 111 sessions
- Can't reproduce official DW-NOMINATE scores HOT 5
- Fortran shouldn't write to stdout HOT 1
- segfault in dwnominate on Mac OS HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dwnominate.