Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing data points better #15

Open
bshor opened this issue Apr 21, 2017 · 3 comments
Open

Handle missing data points better #15

bshor opened this issue Apr 21, 2017 · 3 comments

Comments

@bshor
Copy link

bshor commented Apr 21, 2017

Great package! But I'm still having difficulty with missing values. I'm attaching some data on state polarization for the northeast. Everything's there except the 2014 value for MA. This messes up the plot. I'd like to have the 2008 point for MA go directly to 2014. But as it is, MA gets orphaned after 2008, and the point for 2017 (the end) is not connected to anything.

na.span should do the job but it doesn't.

This is the code I use:

rownames(sg)=sg$st; sg$st=NULL
colnames(sg)=str_c("Year.",colnames(sg))
    
slopegraph(sg, col.line='gray',col.lab = 'black', decimals=1,
     xlabels=c('1996','2000','2004','2008','2014','2017'), 
     cex.lab = 1, cex.num=0.75)

ne polarization slopegraph
slopegraph problem 042117.zip

@ibecav
Copy link
Collaborator

ibecav commented Jul 5, 2018

Hi,

So let's assume that MA was missing in 2008 as you mentioned and that RI was missing in 2004 (it's less subtle and easy to see). You want this straight line interpolation to happen correct?

bbb

@bshor
Copy link
Author

bshor commented Jul 6, 2018

Thanks for taking this up!

I think the correct display should be not to impute a point (eg to display the numeric value) but rather to just draw the line from the last non-missing data value to the next non-missing data value.

For MA it should be a line from 2008 to 2017 with no numeric value present for 2014 (where there is missing data).

@ibecav
Copy link
Collaborator

ibecav commented Jul 9, 2018

Yes that's what it is doing in the example I gave you above. It's just difficult to see that because MA and NJ are so close together at that point. It's easier to see in the RI example where I made 2004 = NA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants