Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stuck on writing a function in R # First, let's write a function `get_col_info()` that takes as parameters a # column name and a dataframe.

Stuck on writing a function in R

# First, let's write a function `get_col_info()` that takes as parameters a # column name and a dataframe. If the values in the column are *numeric*, # the function should return a list with the keys: # - `min`: the minimum value of the column # - `max`: the maximum value of the column # - `mean`: the mean value of the column # If the column is *not* numeric and there are fewer than 10 unique values in # the column, you should return a list with the keys: # - `n_values`: the number of unique values in the column # - `unique_values`: a vector of each unique value in the column # If the column is *not* numeric and there are 10 or *more* unique values in # the column, you should return a list with the keys: # - `n_values`: the number of unique values in the column # - `sample_values`: a vector containing a random sample of 10 column values # Hint: use `typeof()` to determine the column type

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 Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago