main() 0 Newbie Poster

Hi, I have a question with understanding this R script. I don't understand why sapply() has to contain function(x). What happens to the 'x'? This function works if I replace function(x) with function(t) or any other variable. I'm a beginner in R and I would appreciate any help given. Thanks.

simulate <- function(x){
  throws <- x
  sapply(1:2,function(x)sample(1:6,throws,replace=TRUE))
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.