Help assignt task based on latest date and write excel with multiple tabs

Hi,

I need to assign the following taks:

INSTANCE; STATE; MODIFICACION_DATE
401665883;Recibida;17/04/20 21:47:12,000000000
401666005;Recibida;15/04/20 22:19:43,000000000
401665667;Recibida;17/04/20 00:16:27,000000000
401665781;Recibida;17/04/20 19:26:00,000000000
401665732;Recibida;17/04/20 18:25:50,000000000
401662572;Recibida;17/04/20 20:02:28,000000000
401662711;Recibida;17/04/20 14:55:33,000000000
402213314;Recibida;25/04/20 21:03:37,000000000
401748384;Recibida;18/04/20 05:31:37,000000000
402356400;Recibida;29/04/20 21:03:56,000000000
401643688;Recibida;17/04/20 20:36:38,000000000
402357543;Recibida;29/04/20 21:03:58,000000000

to 12 operatorts based on latest MODIFICACION_DATE.

Then, I need to create 4 tables with three operators in each, with each assigned task. Something like this:
OPERATOR; INSTANCE; STATE; MODIFICACION_DATE
operator1;401665883;Recibida;17/04/20 21:47:12,000000000
operator2;401666005;Recibida;15/04/20 22:19:43,000000000
operator3;401665667;Recibida;17/04/20 00:16:27,000000000

Finally, I would like to write (based on the tables above created), two separated excel files with 2 TABS each. (each TAB will contain the single tables above created).

I hope my explanations are clear. Any help will be really appreciat it.

Thanks in advance,
carol

You can use dplyr package.

library(dplyr)
operators <- rep(paste0("operator", 1:3), 4)
Tasks <- tibble(operators, Tasks)

table1 <- slice(Tasks, 1:3)
table2 <- slice(Tasks, 4:6)
table3 <- slice(Tasks, 7:9)
table4 <- slice(Tasks, 10:12)

And use readr package to export
readr::write_excel_csv(table1, "Table1.csv")

I didn't understand whether you want to order your data by the MODIFICATION_DATE in that case you have to arrange the data first like this:

Tasks <- Tasks %>% arrange(MODIFICACION_DATE)

Hope this works for you.

1 Like

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