What is the use of subset() and sample() function in R Programming language? › Category: R Language › What is the use of subset() and sample() function in R Programming language? 0 Vote Up Vote Down Editor">Editor Staff asked 2 years ago What is the use of subset() and sample() function in R Programming language? 1 Answers 0 Vote Up Vote Down Editor">Editor Staff answered 2 years ago Subset() is used to select the variables and observations and sample() function is used to generate a random sample of the size n from a dataset.