Skip to content
Prev 303954 / 398513 Next

Error in if (n > 0)

On Aug 22, 2012, at 3:59 PM, Rich Shepard wrote:

            
I'm not sure I understand why you think there should be any estimate  
when all of one group is censored?
In this case it appears that the plotting function is what threw the  
error:
 > cenboxplot(cu.t$quant, cu.t$ceneq1, cu.t$era, range=1.5, main='Total
+ Recoverable Copper', ylab='Concentration (mg/L)', xlab='Time Period')
Error in if (n > 0) (1L:n - a)/(n + 1 - 2 * a) else numeric() :
   argument is of length zero
 > traceback()
7: ppoints(obs)
6: hc.ppoints(obs, censored)
5: cenros(obs[group == i], cen[group == i])
4: cenros(obs[group == i], cen[group == i])
3: withCallingHandlers(expr, warning = function(w)  
invokeRestart("muffleWarning"))
2: suppressWarnings(cenros(obs[group == i], cen[group == i])$modeled)
1: cenboxplot(cu.t$quant, cu.t$ceneq1, cu.t$era, range = 1.5, main =  
"Total\nRecoverable Copper",
        ylab = "Concentration (mg/L)", xlab = "Time Period")

This succeeds in creating a plot

with( cu.t[cu.t$era=="Mining", ], cenboxplot(cu.t$quant, cu.t$ceneq1,  
range=1.5, main="Total Recoverable Copper", ylab="Concentration (mg/ 
L)", xlab="Time Period") )