Write a function that given a data frame returns the type


Homework - This homework is to be completed in R. Please use basic code for code beginner!

Data frames. Use the diamonds data frame from the ggplot2 library to help you write the following functions.

1. Write a function that given a data frame extracts the column names and prints the names one column name per line to the console.

2. Write a function that given a data frame returns the type of each column (numeric, factor, logical, etc.) and prints the type to the console.

3. Write a function that given a data frame will loop through each numeric column and print the name and mean of that column.

4. Write a function that given a data frame will loop through each factor column and prints a frequency table for that column (Hint: look at the table() function).

5. Write a function that given a data frame will loop through each column and print the column name, the most common element and the number of times that element occurs. Note: If there are multiple elements that appear the same number of times only return one of them.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a function that given a data frame returns the type
Reference No:- TGS02679609

Expected delivery within 24 Hours