Manipulating a character vector by considering a grouping sequnce in r (4)
问题 I am trying to write code based on a Group variable, item.map that has item information that includes a q-matrix showing which item is associated with which group. group <- c(1,2) ids <- c("54_a","54_b","44_a","44_c") item.map <- data.frame( item.id = c("54_a","54_b","44_a","44_c"), group.1 = c(1,1,1,0), group.2 = c(0,1,0,1)) factor <- c(54,44) In this item.map group.1 had 3 items while group.2 has two items. Using this item.map I wanted to assign those items within the chunk of code below