bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!
×
UPTO
50%
OFF!

Functions

Functions are the blocks of code that is written to perform particular job. R programming supports a huge number of in-built functions as well as user-defined ones. In order to create a function in R programming ‘function’ keyword is used.

The syntax for writing functions is-

function_name <- function (argu_1, argu_2, .... argu_N)

{

#Function body

}

For example, a function to calculate the power result of a number.

pow <- function(x, y) {

# function to print x raised to the power y

result <- x^y

print(paste(x,"raised to the power", y, "is", result))

}

Some of built-in functions are seq(),max(), mean(), sum(x), etc.

Calling a function

Taking the above example, a function can be called as follows:

>pow(8, 2)

Output- [1] “8 raised to the power 2 is 64”

"0 Responses on Functions"

Leave a Message

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
top

Sales Offer

  • To avail this offer, enroll before 23rd July 2017.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Functions.