'(R) Write function with vector as variable

I want to create a function and use sapply to pass a number of input variables through it. The trick: the "variables" are actually vectors. I include an example below, where I would like to transpose the vectors a, b, and d, without having to manually write each command individually. I include the x <- part, while leaving it blank, because this is one of the main points of my confusion. Were I creating a normal function, I would simply create a vector of all the variables I want to pass through form5. However, if I create a vector from vectors, I'll just have a longer vector. So to be clear, I'd like sapply to return a matrix or dataframe with all 3 transposed vectors.

a <- c(1:10)
b <- c(11:20)
d <- c(21:30)

X <- 

form5 <- function(x){ 
  t(x)
}

sapply(x, form5)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source