Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a custom function in R?



Write a custom function in R?..

Answer / Rachna Saxena

To write a custom function in R, you can use the 'function' keyword. Here is an example:n```Rn# Custom function to calculate the factorial of a numbernfactorial <- function(n) {n if (n == 0) return(1)n else return(n * factorial(n - 1))n}n# Example usagenfibonacci <- factorial(5)n``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More R Programming Interview Questions

What are applications of recursion?

1 Answers  


Explain the concept of principal component analysis?

1 Answers  


What is s4?

1 Answers  


Describe strsplit() in r string manipulation?

1 Answers  


What is an Atomic vector and how many types of atomic vectors are present in R?

1 Answers  


What is the use of stringr package.

1 Answers  


What is a factor? How would you create a factor in r?

1 Answers  


What is the use of sample and subset functions in R programming language?

1 Answers  


Describe substr() in r string manipulation?

1 Answers  


What is with () and by () function in r is used for?

1 Answers  


how can you add datasets in r?

1 Answers  


What is R studio and how to use it?

1 Answers  


Categories