Answered step by step
Verified Expert Solution
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:
- apply(zz[-1,], 2, min)
- zz[zz[,3]>24,]
- zz[order(zz["smoking"], zz["age"]), ]
- subset(zz, zz["sex"]==2)
- tapply(zz$age, zz$smoking, max)
- apply(zz[,-3], 1, function(x){ sum(x) })
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started