Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8328731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:32:22+00:00 2026-06-09T01:32:22+00:00

I have two matrix extracted from different csv files, One is like > matrix1[1:6,]

  • 0

I have two matrix extracted from different csv files,

One is like

> matrix1[1:6,]
     V1        V2
 1   atheism 1.0000000
 2       rec 1.0000000
 3       alt  1.0000000
 4  baseball 1.0000000
 5     sport 1.0000000
 6    season 0.4934226

Another is

>matrix2[1:6,]
         V1        V2
 1       alt 1.0000000
 2   atheism 1.0000000
 3  baseball 1.0000000
 4       rec 1.0000000
 5     sport 1.0000000
 6         c 0.4934226

What I want to do is to compare two matrix, this is what I did

mapply(as.data.frame(test1),as.data.frame(test2),FUN=function(v1,v2) all(v2==v2))
        V1   V2 
       TRUE TRUE

However, what I need is to capture the difference in the first column between the two data set, but what I did failed to capture the difference in string, how to modify my code. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:32:24+00:00Added an answer on June 9, 2026 at 1:32 am

    maybe try:

    union(test1[, 1] , test2[, 1])    #the same (together)
    intersect(test2[, 1], test1[, 1]) #overlap
    union(test1[, 1] , test2[, 1]) [!union(test1[, 1] , test2[, 1]) %in% intersect(test2[, 1], test1[, 1])]
    setdiff(test1[, 1] , test2[, 1])  #diff in set 1
    setdiff(test2[, 1] , test1[, 1])  #diff in set 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two matrices of different sizes. Let's just define matrix {a} as a(1:10)
I have two classes (MVC view model) which inherits from one abstract base class.
I have two bitmaps, produced by different variations of an algorithm. I'd like to
I have a vector containing simple time series data (extracted from a deSolve matrix),
I have two matrices x and y, both are results from different algorithms/routines that
I have two matrix one X with all the feature values with 300000 rows
I have two matrix with the same number of columns, but with different number
I have a problem with generics in c++.I have two Matrix.h and Matrix.cpp files.Here
In short: I have two matrices (or arrays): import numpy block_1 = numpy.matrix([[ 0,
I have a code base, in which for Matrix class, these two definitions are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.