Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (50.2k points)

In my data frame, I am having 3 columns and 1000+ rows that are being generated from R. The data types of the first two columns are strings and the last characters are similar in some columns. I want to filter out data only from non-similar rows.


    AAA.aa BBB.aa 0.9

    AAA.aa 0.8 0.7 0.8

I want my output as:

    AAA.aa 0.8 0.8

Any help would be highly appreciated.

1 Answer

0 votes
by (108k points)

I think the following code will work for you:

    filter <- apply(Z,MARGIN = 1,function(x){

                                             paste(x,collapse = "")

                                             }) %>% duplicated


If you are a beginner and want to know more about R then do check out the R programming course.

Browse Categories