Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer Using R Let sex = c(1,1,1,1,1,2,2,2,2,2); smoking = c(1,0,1,0,1,0,0,0,1,1); age=c(21:30) in R. A data frame is constructed as zz = data.frame(sex, smoking, age). Give

Answer Using R

Let sex = c(1,1,1,1,1,2,2,2,2,2); smoking = c(1,0,1,0,1,0,0,0,1,1); age=c(21:30) in R. A data frame is constructed as zz = data.frame(sex, smoking, age). Give the results of following R commands:

  1. apply(zz[-1,], 2, min)
  2. zz[zz[,3]>24,]
  3. zz[order(zz["smoking"], zz["age"]), ]
  4. subset(zz, zz["sex"]==2)
  5. tapply(zz$age, zz$smoking, max)
  6. apply(zz[,-3], 1, function(x){ sum(x) })

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is a software suite? Give several examples.

Answered: 1 week ago

Question

4. Solicit help from parents.

Answered: 1 week ago