Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

> 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 38

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

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

1. What is nonverbal communication?

Answered: 1 week ago