Write a function which will print the name of a person along with a hello message, like Hello Person Name
R Programming Language Function in R Language (Article) Function in R Language (Program)
634Program:
# Below is our function hello.person <- function(name) { sprintf("Hello %s", name) } # to invoke the function, call the function hello.person("Rumman")
Output:
[1] "Hello Rumman"
Explanation:
This is a user defined function using R programming Language. Another way to do that.
hello.person <- function(firstName, lastName) { print(sprintf("Hello %s %s", firstName, lastName)) } hello.person("Rumman", "Ansari") hello.person(lastName = "Ansari", firstName = "Rumman")
If you will run the above program you will get the following result
> hello.person("Rumman", "Ansari") [1] "Hello Rumman Ansari" > hello.person(lastName = "Ansari", firstName = "Rumman") [1] "Hello Rumman Ansari" >
This Particular section is dedicated to Programs only. If you want learn more about R Programming Language. Then you can visit below links to get more depth on this subject.