0

Getting the following error when trying to draw boxplots

Error in attr(groups, "names") <- names : 'names' attribute [5] must be the same length as the vector [2]

I'm trying to create a graph with 5 box and whisker plots in it by doing the following

boxplot(newton.FS.df,newton.B.df,newton.NFS.df,newton.NAFS.df,newton.AFS.df,
        col=(5),
        main="Strata VS Refractive Index",
        names=c("FS","B","NFS","NAFS","AFS"),
        ylab="Refractive Index") 

Where i have already saved newton.FS.df and so on as the values I need - why am I getting this error? is it because I only have two columns in my data? How do I make 5 boxplots in a graph with only two columns of data?

  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Ronak Shah Sep 04 '18 at 05:02
  • According to `?boxplot` `for specifying data from which the boxplots are to be produced. Either a numeric vector, or a single list containing such vectors. Additional unnamed arguments specify further data as separate vectors (each corresponding to a component boxplot)` What are those objects `newton.FS.df`, `newton.B.df` etc? – akrun Sep 04 '18 at 06:27

0 Answers0