Hi, I'd appreciate some help with an issue I'm having. When creating a bar plot using the following:
barplot(table(Mydata$MsType, Mydata$Rel1yPre), ylim=c(0,90),
col=c("navyblue", "seagreen", "tomato3"),
xlab="Number of Relapses 1y Pre diagnosis",
main="Type of MS vs. Number of Relapses 1 year prior to Diagnosis",
legend.text=c("PPMS", "RRMS", "SPMS"),
I've realised that for some reason the value of the variables is assigned depending on the order I put it in, which results in incorrect data being shown on the plot. For example, if I put "RRMS", "PPMS", "SPMS" (instead of the above) the plot simply changes the colours and incorrectly shows the frequency of RRMS as belonging to PPMS. I've only noticed because I know my data and I'm worried im getting incorrect plots!
I'm clearly doing something wrong - I'm still a beginner so I'd appreciate it if someone could guide me as to what the issue is.