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 6880491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:58:51+00:00 2026-05-27T04:58:51+00:00

I would like to calculate distance between two groups. I am very confused. I

  • 0

I would like to calculate distance between two groups.
I am very confused.

I have a two data sets. One is about a company and one is about employees.

I would like to find out how their age( a company in which an employee is hired and an employee) are similar or not.
I think I need to standarize also..

  1. calcuate euclidean distance between each person and a company. (4-5 people in a company)
  2. calculate euclidean distance between each person and a company in industry level.

My dataset is like this:

person person_age    company company_age industry              

1        50             1       5         1

2        40             1       5         1

3        30             2        1        1

4        20             2        1        1

5        25             3        8        2

The following code will reproduce my data.frame:

person <- 1:5
person_age <- c(50,40,30,20,25)
company <- c(1,1,2,2,3)
company_age <- c(5,5,1,1,8)
industry <- c(1,1,1,1,2)
myData <- data.frame(person, person_age, company, company_age, industry)

Please help me.
I don’t mind using SAS or R.
I am very confused.

  • 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-05-27T04:58:52+00:00Added an answer on May 27, 2026 at 4:58 am

    So if you just want Euclidean distance on each person’s age you can do something like:

    d <- dist(myData[c("person","person_age")])
    

    Your question is still incredibly malformed. For example, what does “calcuate [sic] euclidean distance between each person and a company” mean?

    If you just want to know the distance between each person and the company they work for, you could code that as:

     with(myData, ((person_age - company_age)^2)^.5 ) 
    

    which is simply the 2d Euclidean distance formula

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to calculate the distance between two x/y coordinates on the surface
I would like to be able to calculate the family relationship between two individuals
Hi I have the need to calculate the distance between two points having the
I would like to calculate the similarity between users, which is reciprocal. similarity[:user1][:user2] ==
I have a matrix mat and would like to calculate the mean of the
Good morning, I have mysql queries where I would like to calculate percentage of
I have two arrays of x - y coordinates, and I would like to
I would like to be able to calculate distance based upon movement, as in
In the code below I am trying to calculate the distance between two cities.
I need to calculate the Delta-E distance between two colors. The algorithm to do

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.