Question: Explain the relationship/analysis based on the date below > Dataset

Explain the relationship/analysis based on the date below

> Dataset <- within(Dataset, {

+ admsrc <- as.factor(admsrc)

+ Age <- as.factor(Age)

+ NumDxCodes <- as.factor(NumDxCodes)

+ Sex <- as.factor(Sex)

+ })

> local({

+ .Table <- with(Dataset, table(admsrc))

+ cat(" counts: ")

+ print(.Table)

+ cat(" percentages: ")

+ print(round(100*.Table/sum(.Table), 2))

+ })

counts:

admsrc

1 2 4 5 6 7

141 2 4120 9 177

percentages:

admsrc

1 2 4 5 6 7

36.15 0.51 10.51 5.132.31 45.38

> local({

+ .Table <- with(Dataset, table(Age))

+ cat(" counts: ")

+ print(.Table)

+ cat(" percentages: ")

+ print(round(100*.Table/sum(.Table), 2))

+ })

counts:

Age

2 34 5 6 7 8 9

3 31 44 31 62 84 88 47

percentages:

Age

2 3 4 5 6 7 8 9

0.77 7.95 11.287.95 15.90 21.54 22.56 12.05

> local({

+ .Table <- with(Dataset, table(dischdest))

+ cat(" counts: ")

+ print(.Table)

+ cat(" percentages: ")

+ print(round(100*.Table/sum(.Table), 2))

+ })

counts:

dischdest

01 0305 06 07 20 5051 62 63 65

103 53 1 167 3 21 8 3 25 4 2

percentages:

dischdest

01 03 05 06 07 20 50 51 62 63 65

26.41 13.59 0.26 42.82 0.77 5.382.05 0.77 6.411.03 0.51

> local({

+ .Table <- with(Dataset, table(NumDxCodes))

+ cat(" counts: ")

+ print(.Table)

+ cat(" percentages: ")

+ print(round(100*.Table/sum(.Table), 2))

+ })

counts:

NumDxCodes

4 5 6 7 8 9

2 3 7 12 16 350

percentages:

NumDxCodes

4 5 6 7 8 9

0.51 0.771.79 3.08 4.10 89.74

> local({

+ .Table <- with(Dataset, table(Sex))

+ cat(" counts: ")

+ print(.Table)

+ cat(" percentages: ")

+ print(round(100*.Table/sum(.Table), 2))

+ })

counts:

Sex

1 2

198 192

percentages:

Sex

1 2

50.77 49.23

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!