Question

Do this homework by R and put the syntax of R and corresponding outputs under respective...

Do this homework by R and put the syntax of R and corresponding outputs under respective questions. Do not turn in separate pages of R commands and outputs, such homework will not be graded. Therefore edit your homework accordingly.

1. A national equal employment opportunities committee is conducting an investigation to determine if women employees are as well paid as their male counterparts in comparable jobs. Random samples of 75 males and 64 females in junior academic positions are selected and their salary data is stored in “salaries.csv”. (a) Find the mean and the standard deviation of each group.

Data:

gender income
Male 48932
Male 48281
Male 49885
Male 48646
Male 49391
Male 48824
Male 49459
Male 48685
Male 49932
Male 48779
Male 47685
Male 48984
Male 48616
Male 47362
Male 46919
Male 47676
Male 47932
Male 48494
Male 49161
Male 48201
Male 48089
Male 48287
Male 48028
Male 48240
Male 48312
Male 47827
Male 47839
Male 48578
Male 49740
Male 48942
Male 49759
Male 48134
Male 47934
Male 47702
Male 46989
Male 48716
Male 49599
Male 48713
Male 49089
Male 48452
Male 48097
Male 47012
Male 48584
Female 46737
Female 48929
Female 47321
Female 47952
Female 47958
Female 47563
Female 47843
Female 46724
Female 46122
Female 48661
Female 47558
Female 47914
Female 46808
Female 48822
Female 48373
Female 47905
Female 47196
Female 46710
Female 46597
Female 47727
Female 47421
Female 47244
Female 48538
Female 47944
Female 47615

I know the two commands for entering it in are

salaries=read.table("C:/Data/salaries.csv",sep=",")

names(salaries)=c("gender","income")

But when i try to get the mean, it gives me :

mean(salaries$income,na.rm=T)
[1] NA
Warning message:
In mean.default(salaries$income, na.rm = T) :
argument is not numeric or logical: returning NA

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I stored the data set that you provided above in a .csv file and then ran the following R commands and I got the following output. The command lines are given in bold.

> salaries=read.csv("C:/Users/DGDesktop/Desktop/salaries.csv")
> aggregate(salaries$income,by=list(salaries$gender),FUN=mean)
Group.1 x
1 Female 47607.28
2 Male 48476.88
> aggregate(salaries$income,by=list(salaries$gender),FUN=sd)
Group.1 x
1 Female 736.6504
2 Male 764.1954

So, after the two commands that you gave you need to give these two command lines to get the mean and standard deviation:
aggregate(salaries$income,by=list(salaries$gender),FUN=mean)
aggregate(salaries$income,by=list(salaries$gender),FUN=sd)

Add a comment
Know the answer?
Add Answer to:
Do this homework by R and put the syntax of R and corresponding outputs under respective...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • gender income Male 48932 Male 48281 Male 49885 Male 48646 Male 49391 Male 48824 Male 49459...

    gender income Male 48932 Male 48281 Male 49885 Male 48646 Male 49391 Male 48824 Male 49459 Male 48685 Male 48215 Male 49362 Male 47647 Male 48860 Male 47438 Male 47052 Male 48157 Male 48349 Male 49589 Male 48579 Male 48411 Male 49048 Male 48705 Male 49932 Male 48779 Male 47685 Male 48984 Male 48616 Male 47362 Male 46919 Male 47676 Male 47932 Male 48494 Male 49161 Male 48201 Male 48089 Male 48287 Male 48028 Male 48240 Male 48312 Male 47827...

  • Complete this homework by R and put the syntaxes of R and corresponding outputs under respective...

    Complete this homework by R and put the syntaxes of R and corresponding outputs under respective question [Example Question] Find the mean and the variance of milk yield data. > mean(task) [1] 36.15385 I apologized i put the wrong qs A medical researcher wishes to determine if a pill has the undesirable side effect of reducing the blood pressure of the user. The study involves recording the initial blood pressure of 15 college-age women. After they use the pill regularly...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT