I have matrix that contains 2 columns. First column name is fuzzified and the second is relasifuzzi.
fuzzified relasifuzzi
1 2
2 3
3 5
5 9
9 8
9 10
9 7
I want to make a group like this:
fuzzified relasifuzzi
1 2
2 3
3 5
5 9
9 8, 10, 7
How can I get like this in R?
library(data.table)
setDT(k1)[,.(relasifuzzi=paste(relasifuzzi,collapse=",")),by=fuzzified]
fuzzified relasifuzzi
1: 1 2
2: 2 3
3: 3 5
4: 5 9
5: 9 8,10,7
k1<-structure(list(fuzzified = c(1L, 2L, 3L, 5L, 9L, 9L, 9L), relasifuzzi = c(2L,
3L, 5L, 9L, 8L, 10L, 7L)), .Names = c("fuzzified", "relasifuzzi"
), class = "data.frame", row.names = c(NA, -7L))
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments