It seems nnls does not give you the intercept, do you have any idea of how to phrase the problem to get the intercept to be non negative as well?

Olu ]]>

I’m not sure what’s going on there. I just installed nnls via install.packages() and everything worked from there. Sorry!

]]> in .Fortran(“nnls”, A = as.numeric(A), MDA = as.integer(MDA), M = as.integer(M), :

“nnls” not available for .Fortran() for package “nnls”

which I can’t make heads or tails out of… Any help would be much appreciated!

]]>It’s hard to know the problem without seeing the data and code, but you should be able to get the effect you want. Feel free to download the source code from https://github.com/jkeirstead/r-slopegraph and play around with it.

]]>1. I keep getting this when I try to run the code: “Error: Zero breaks in scale for y/ymin/ymax/yend/yintercept/ymin_final/ymax_final”

2. A possible source of problem is that my spreadsheet has some missing data — I’m trying to slopegraph entries over four different years, but a few entries don’t exist in all the years. Will this cause problems? If so, is there a way around this?

3. I am interested in creating a slopegraph in a slightly different setup than you have. Rather than display the values at each step, I’d rather track the categories. So if entry “Smith” is in rank 1 in the first year, rank 5 in the second year and rank 10 in the third year, I’d like the graph to show “Smith” as the label for each of Smith’s positions, rather than “1,” “5″ and “10.” Is it possible to tweak your code to do this?

I am unfortunately a relative novice at R — I’ve used it to accomplish a few tasks, usually by reading and altering tutorials. If you’re able to assist me in this I’d be very grateful. I realize this is complicated a complicated series of questions…

Thanks.

]]>Awesome work; thank you sharing your code! I have been looking for a good way to plot a small data set, and slopegraphs finally came to mind. Your code made this easy.

After downloading the latest version on Github (December 2013), the first run threw a couple of errors. plyr and ggplot2 need to be loaded, and were not.

I also would like to suggest plotting the labels on both the left and the right side of the plot. I accomplished this by modifying slopegraph.r:

In theme_slopegraph(), don’t plot the y axis text:

axis.text.y = element_blank(), # axis.text.y = element_text(size=rel(0.8)),

and in plot_slopegraph(), replace scale_y_continuous() with

+ geom_text(data = subset(df, x == df$x[length(df$x)]),

aes(x = factor(x), label = sprintf(” %s”, group)),

size = rel(2.8), hjust = 0) +

geom_text(data = subset(df, x == df$x[1]),

aes(x = factor(x), label = sprintf(“%s “, group)),

size = rel(2.8), hjust = 1)

The above code was adapted from the slopegraph implementation of Bob Rudis at http://rud.is/b/2013/01/11/slopegraphs-in-r/

Lastly, I have a data set with two x-axis factors where the Tufte method doesn’t correctly order the right-side data (the right side retains the rank order of the left side). The “spaced” method works correctly. I haven’t figured out, yet, why this isn’t plotting correctly, but I’d be happy to share the data if you’re interested.

Thanks, again.

]]>