Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ"

Hi, so I am a new Rstudio user and I am trying to make a line graph with multiple lines. Then, I am getting an error message that says "Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ".

The code is

plot(a$week.no,a$no.case,type='p',ylim=c(0,64),col='black',pch=19,cex.axis=1.2,
cex=1.2, cex.lab=1.2,xlab="week.no",ylab="number new case")

and I already ran

length(a$week.no)
[1] 0
length(a$no.case)
[1] 64

Please, I want this help

What is the object a? If it is a data frame, I suspect you have misspelled the name of the column week.no. Run this code

colnames(a)

and check the column names.

Thank you so much for your help.
I just ran with your advice and I already got it.
:joy: :joy: :joy:

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.