invalid subscript type 'closure' error

hi,

I am trying to plot bayesian skyline plot using Tracer generated data in R. For one one of the lines in my code it gives the following error:

lines(as.numeric(as.character(skydat$Time)),log10(as.numeric(as.character(skydat$Median))),lwd=3,col=paste(rgbcols[t]))
Error in rgbcols[t] : invalid subscript type 'closure'

I am not sure what's the issue in the code above.

Hi, I'd need to know more about rgbcols. My instinct is that you're getting this because rgbcols is a list, and so paste(rgbcols[t]) is a list; colour usually needs to be specified as a string (see the 'Color Specification' section of ?lines).

Please share a reproducible example which isn't necessarily based on your skydat data (so maybe make an example with a built-in dataset like iris instead of your Tracer data) and give detail on what rgbcols is. Hope that helps,

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.