getting error in r plot

plot(data_mibor$date, data_mibor$mibor_1m, type = "l",col = "blue", xlab = "Year", ylab = "Rate", lwd= 3,

  •  main = "MIBOR_1m")
    

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

Thanks in advance.

When I do this

data_mibor= data.frame(
   date = 1:5,
   mibor_1m = (1:5)/2
)

plot(data_mibor$date, data_mibor$mibor_1m, type = "l",col = "blue", xlab = "Year", ylab = "Rate", lwd= 3,
     main = "MIBOR_1m")

Created on 2020-06-10 by the reprex package (v0.3.0)
the plot is shown without an error, so you syntax is okay.

Your message suggests that data_mibor$date and data_mibor$mibor_1m have different lengths.
Check this by comparing length(data_mibor$date) and length(data_mibor$mibor_1m)
and find out what went wrong.

1 Like

Thanks a lot.
The error was Date vs date.

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