0

I generated a task and assigned an order variable ("Date"). So, I have access to the following elements:

task$row_ids and task$col_roles$order.

The latter helps me to double-check the name of the ordering variable, so I can retrieve the order variable e.g. by task$data(cols = c("Date")).

Now, as the row_ids are only guaranteed to be unique natural numbers (and not necessarily a sequence): How can I be sure that a command like

Lookup<-tibble(task$data(cols = c("Date")), task$row_ids)

generates a table that I can later use to recover the Date identifiers of the rows in task$data()? Or ist this trivial, as the order is respected by construction? (and I assigned order role to the Date column)

ds_col
  • 129
  • 10

1 Answers1

1

If you just want to have a lookup table with row ids with dates, you can get this with:

task$data(cols = c(task$backend$primary_key, "Date"))

Also note that task$data(..., ordered = TRUE) automatically reorders the data according to your Date column, but the default of the ordered argument is subject to change in the next release. If you are already working with ordered tasks (which is still kind of in development), explicitly state ordered = TRUE to be on the safe side.

Michel
  • 635
  • 3
  • 5