R 教材:函式 |
# File name: func_1.r hello <- function(input){ a <- c("Hello", "world", input, "!") input <- NULL molas <- "molas" ret <- paste(a, collapse = " ") ret } molas <- "MOLAS" input <- c("again,", molas) input hello(input) molas input hello() hello(NULL) |
# File name: func_2.r hello <- function(a, ...){ ret <- paste(a, ...) ret } test <- function(input = "molas") { a <- c("Hello", "world", input, "!") input <- NULL molas <- "molas" ret <- hello(a, collapse = " ") ret } molas <- "MOLAS" input <- c("again,", molas) input test(input) molas input test() test(NULL) |
陳韋辰 (04/08/19) --- |