get value from matrix that have same value in other column in R

Beti Endaryati

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?

user227710
    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

data

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.

edited at
0

Comments

0 comments
Login to comment

Related

Check for same value we have same unique value in other column in R

How to get records from a table with two column have same value?

How do I get the ID column (& other columns) that do not have the same value in the city column?

Get value from other row in same group in r

Remove the rows that have the same column A value but different column B value from df (but not vice-versa) in R

Dynamically get value from column1 and assign it to NaN values in same column, if they all have the same column2 value

Get value in column from matrix of row numbers

Get values in one column that correspond with max value of other columns in a matrix (R)?

Hibernate get value of column from other table

get one value from many same value in same column php

In R: Replace NAs with values of other row but same value in other column

Dataframe get value for a column with other column in same df

how to get a row from sql table which have a column value equal to maximum of count of a column value of same sql table

data.table in R: Replace a column value with a value from same column after matching two other columns values

Returns all rows which have same column value based on other column value

Filtering a matrix by the same value in R

How to get other column's value of the same row using textfinder()?

Select n row have highest combined value from a matrix in R

Get distinct column value from a specific value ignoring value from other retrieved column - mysql

Get column index nr from value in other column

Python: get value from column selected in other column

Merging rows from two files if they have the same column value

Splitting value from one row to other rows in the same column in pandas

How to get a value from every column in a Numpy matrix

Using a Matrix to Populate Every Other Value in a Column

Get value of all column from one table and get value of other column from second table

Get column value of a row if it matches other column value from other row

take 4*4 matrix from user to test if it includes 2*2 sub-matrix have the same value

How to get the maximum value from one column grouped by other columns in R data frame?