Change factor in a number

Hello,
I've a dataset, and i import and change it in xts form. After this i create a new variable for make a plot with the date and one of the column. I have a error in the plot ("X" must be a time series object). I think that the problem is in the column because it result not a number but a factor. I try to change it with "as.number" or as.character but i have this error: "Warring message: si prodotto un NA per coercizione"
Thank u all

Hi Anto, could you tell us a bit more? I'd love to help but don't think I have enough info.

Reading your post there are two things you could perhaps adress to make sure we're on the same page:

  1. A time series object is a distinct and separate thing from something that can be plotted as a time series (in a much broader sense of the word). The error you refer to is saying that what you're feeding it is in fact not a time series object (an object with class "ts" or "xts").
  2. What you posted is not an error message but a warning message. So what you're trying to accomplish should likely be able to run with just a warning message. So that's likely not where the problem lies.

Can you give an example of your code so we can reproduce your error & warning and see how we can help?

1 Like

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