0

This is the line of code returning an error:

barplot(SurveyInfo, main="State Anxiety Pre-Experiment", xlab="ID", ylab="Anxiety Level", beside=TRUE, col=rainbow(7))

Note: I tried adding range of 1 into the code and it didn't fix the problem.

This is the previous code in the same script where I created the variable itself:

SubjInfo <- merge(SubjInfo,SubjInfoPre,by="ID") 
SurveyInfo <- SubjInfo %>% 
select(STAIY1_pre, STAIY1_post, STAIY2, BIS11, BDIII, RGPTSA, RGPTSB) 

This is what the data looks like

  • 1
    Welcome to Stack Overflow. We cannot read data into R from images. Please [make this question reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including a small representative dataset in a plain text format - for example the output from `dput(SurveyInfo)`, if that is not too large. – neilfws Dec 02 '21 at 03:34
  • the error is pretty self-explanatory, you need to turn `SurveyInfo` into a vector or matrix: `barplot(t(SurveyInfo))` or `barplot(t(t(SurveyInfo)))` which would be the same as `barplot(as.matrix(SurveyInfo))` – rawr Dec 02 '21 at 04:58

0 Answers0