I have a data frame whose column col2 as two or more values. Example:
col1 <- c(210,222)
col2 <- c((1A,1B),(1B,1A))
I have tried the following code in R which isn't giving the desired output. Any suggestions.
comp = (sort(col2, partial = NULL, na.last = TRUE, decreasing = FALSE,
method = c("quick"), index.return = TRUE))
comp <- data.frame(comp)
My desired output is (without splitting the values in col2) since I need to be able to count those values.
col1 <- c(210,222)
col2 <- c((1A,1B),(1A,1B))
example: if 210 & 222 have two names (James, Allen) & (Allen,James). I need the output to be (Allen, James) (Allen, James) to the corresponding ids 210 & 222.Below is a sample of my code. The above were just a hypothetical example.
Thank you in advance.