1

I have 8 ids and want to build a model with these ids. Then make forecasting these labels because labels are our target variable and we want to predict it for each id. Additionally, I want to make the dataset tabular from the time series. How can I do that?

`test_df <- data.frame(ID = c("806667", "2801545", "987450", "1622629", "597231", "483735", "267637", "309212"),
                      Date = c("01-01-2020", "01-02-2020", "01-03-2018", "01-04-2018", "01-05-2015", "01-06-2015",
                               "01-07-2012", "01-08-2012"),
                      X1 = paste0("X", 1:8), 
                      X2 = c(300, 400, 315, 258, 200, 410, 367, 165),
                      Label = c("0", "0", "0", "1", "0", "0", "0", "0"))`

This is my code how should I transform this to a tabular form?

  • 1
    [Please don't post images of code/data/errors.](https://meta.stackoverflow.com/q/285551) You can [edit](https://stackoverflow.com/posts/i76689853/edit) your question and replace the images with [properly formatted](https://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks) text. See: [*How to ask a good question*](https://stackoverflow.com/help/how-to-ask) – Woodford Jul 14 '23 at 17:35
  • 2
    What do you mean by "tabular form"? I normally think of a data frame as being a type of tabular data. – Jon Spring Jul 14 '23 at 18:19
  • 1
    Apart from the "tabular" part, you might consider converting the Date column into a Date format so you can calculate and visualize in R with it, e.g. `test_df$Date = as.Date(test_df$Date, "%m-%d-%Y")` – Jon Spring Jul 14 '23 at 18:21
  • the variables will be laying in rows, not like columns. – Şeyma Günönü Jul 14 '23 at 19:19
  • Please show the expected output to clarify what is wanted. – G. Grothendieck Jul 14 '23 at 19:20

0 Answers0