How to use sapply in r?
Answer / Ashish Khare
sapply is a function from the base R package that applies a function to each element of an object (like a list or vector) and returns a simplified result. For example, sapply(c(1, 2, 3), function(x) x^2) will return a vector containing the squares of the numbers 1, 2, and 3.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between rnorm and runif functions ?
Explain what is t-tests in r?
How would you create a new r6 class?
How to create vectors in r?
How would you find out the mean of one column with respect to another?
Explain how to create a list in r?
What is compiler in r?
In r how missing values are represented?
How would you do a left and right join in r?
What is inheritance in s3 class?
What is the table in r?
What are the applications of R?