I am using the separate
function in order to deal with a text with variable size.
In the separate function, there is a need to details the name of the new columns in which the text is separate. Nevertheless, in my case the text has variable length. I would like the number of columns to be needed automatically generated.
For instance I am just calculating the number of columns to be needed by counting the number of characters that I am using for key separation (which in my case is ,
). Then I enter manually the number of columns to be needed
max(str_count(Applicant_data$Assignee_DWPI, ";"),na.rm = TRUE)
separate(Applicant_data,Assignee_DWPI, c("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"), sep = " ; ")
I would like to get the number of columns automaticly generated.