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...


How would you write a custom function in r? Give an example.



How would you write a custom function in r? Give an example...

Answer / Awani Yadav

In R, you can define your own functions using the `function()` keyword. Here's an example of a simple custom function that calculates the factorial of a number: nn```rnfactorial <- function(n) {n if (n == 0) return(1)n else return(n * factorial(n - 1))n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More R Programming Interview Questions

What are the different import functions in r?

1 Answers  


What is power analysis ?

1 Answers  


What is the regular expression in R string manipulation?

1 Answers  


R programming language has several packages for data science which are meant to solve a specific problem, how do you decide which one to use?

1 Answers  


Explain different types of atomic vectors in R?

1 Answers  


What is a dataframe in r?

1 Answers  


What is a white noise model?

1 Answers  


How will you measure the probability of a binary response variable in r language?

1 Answers  


What is polynomial in r?

1 Answers  


Write the syntax to set the path for a current working directory in r environment?

1 Answers  


Explain how R programming applied to the real world?

1 Answers  


How data is aggregated in r?

1 Answers  


Categories