I just found a workaround. I just modified the

df % mutate(cs1=cumsum(value))

to

df % mutate(cs1=round(cumsum(value),2))

and now it works! ]]>

The later might be better for float values as, with rounding, your final_value might not equal 0 exactly. Additionally I would rewrite the if statement to use the testthat package and an expect statement. That would let you set an explicit epsilon (or error tolerance) for checking that decimal values add to 0.

]]>I am trying to produce my own waterfall plot, but unfortunately I get the

` error in sprintf("Final value doesn't return to 0. %.2d instead.", final_value):`

invalid format '%.2d'; use format %f, %e, %g or %a for numeric objects

Called from: sprintf("Final value doesn't return to 0. %.2d instead.", final_value)

Does that mean I am not allowed to use decimal numbers!?!? That would be strange…

My value vector ** df$value** looks like this:

The plotting is easy: it was done with ggplot2. The data frame contains columns for x1, x2, dataset, choice and so the code is something like:

`ggplot(data, aes(x=x1, y=x2)) + geom_point(aes(colour=choice, size=dataset))`

I saw your coding for How to: Multinomial regression models in R”. This is a new technique which I am trying. You mentioned the above coding may not be adequate for more complex models. What would you suggest in stead? Also how did you go about plotting the data. I’ve used a confusion matrix to validate my model but I would like to visualize it if possible.

My optimal five level multinomial model contains 4 continuous variables, 1 categorical (2 levels) and 2 interactions.

Many thanks

Sophie

]]>Can you please read chapter 9 and try to use the derivative of the observations in the R code. ]]>