Business Analytics with R (33 Blogs) Become a Certified Professional

Introduction to Functions in R

Last updated on May 22,2019 2K Views

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-mobile-banner-bg

myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

Functions in R

Functions in R can be user defined and in-built functions. To define a function, a name is assigned and the keyword function is used to denote the start of the function and its argument list. Functions are created using the function () directive and are stored as R objects just like anything else. In particular, they are R objects of class function. Functions can be passed as arguments to other functions. Functions can be nested, so that you can define a function inside another function.

User-defined Function

A user-defined function is a function provided by the user of a program or environment in a context where the usual assumption is that functions are built into the program or environment.

The variable x is a formal parameter of the function. When the function is called, it is passed as an arguement that provides a value for the formal parameter.

In-built Function

There is a function called the repeat function which means to repeat a value a number of time. Repeat series is repeat 1:6 twice as you can see in the image. All this data can be created whenever required and elements of the series can also be repeated.

Introduction to Functions in R

cbind Function and rbind Function

cbind function combines vector, matrix or data frame by columns. rbind function combines vector, matrix or data frame by rows.

Introduction to Functions in R Introduction to Functions in R

Got a question for us?? Please mention them in the comments section and we will get back to you.

Related Posts:

Introduction to Supervised Learning

What is R?

Get started with Data Science

Comments
0 Comments

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.