Return Value from R Function (3 Examples) | Output with / without return() | Multiple Values as List

preview_player
Показать описание
R code of this video:

my_fun1 <- function(x, y) { # R function with return
z <- x + y
return(z)
}

my_fun1(x = 5, y = 3) # Apply function 1

my_fun2 <- function(x, y) { # R function without return
z <- x + y
z
}

my_fun2(x = 5, y = 3) # Apply function 2

my_fun3 <- function(x, y) { # Return multiple values
z1 <- x + y
z2 <- x * y
return(list(z1, z2))
}

my_fun3(x = 5, y = 3) # Apply function 3

Follow me on Social Media:

Рекомендации по теме
Комментарии
Автор

Hi 👋 Sir I have a doubt I have a dataset in that all variables are classification what can I do with it?

sabarikrishna
Автор

Sir I need your help in my project. I am going to take a survey so I need your help in choosing survey topics. Can you give 5 to 10 survey topics so that I can choose any easy or useful survey topics sir . Sir give a survey topics with that dataset I should give targets like with that survey what I am going to say . Sorry Sir if I were wrong.

sabarikrishna
welcome to shbcf.ru