Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read a data set in R as a data frame. How to write a function that takes as arguments: 1) a data frame, 2) a
Read a data set in R as a data frame.
How to write a function that takes as arguments: 1) a data frame, 2) a column number
for that data frame, and outputs: 1) the maximum value of that column ; 2) the row
index (or patient) corresponding to that maximum value; 3) the minimum value of
that column; 4) its corresponding row index.
The answer should following the way like this:
> max . calc for (j in 3:8) print (max.calc(dat,j)) max.val max.ind min.val min.ind 114 121 119 118 max.val max.ind min.val min.ind 7 max.val max.ind min.val min.ind 7 27 100 max.val max.ind min.val min.ind 8 27 102 max.val max.ind min.val min.ind 10 115 24 97 max.val max.ind min.val min.ind 24 63 18 38 > max . calc for (j in 3:8) print (max.calc(dat,j)) max.val max.ind min.val min.ind 114 121 119 118 max.val max.ind min.val min.ind 7 max.val max.ind min.val min.ind 7 27 100 max.val max.ind min.val min.ind 8 27 102 max.val max.ind min.val min.ind 10 115 24 97 max.val max.ind min.val min.ind 24 63 18 38Step 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