User Defined Functions in R Exercises (Part 1)

In the Exercises we will discuss User Defined Function in R

Answers to the exercises are available here.

Exercise 1

Create a function to print square of number

Exercise 2

Create a function to print a number raise to another with the one argument a default argument
Exercise 3

Create a function to print class of an argument

Exercise 4

Create a function to accept two matrix arguments and do matrix operations with same.

Exercise 5

Create a user defined function to accept a name from the user

Exercise 6

Create a user defined function to accept values from the user using scan and return the values

Exercise 7

Create a user defined function to create a matrix and return the same.

Exercise 8

Create a function to take two arguments, one student marks and other student names and plot a graph based on the same.

Exercise 9

Create a function to accept an employee data frame(Name,Gender,Age,Designation & SSN) and print the First & Fifth employee as well as the Names & the Designation of all the employees in the function

Exercise 10

Create a function to create an employee data frame(Name,Gender,Age,Designation & SSN) and return the Name,Age & Designation of all employees.