-3

Sampling the dataset in data science to build the predictive model is pretty important .suggest me good resource for data sampling in the R language and good package for it

CrazyPanda
  • 27
  • 4
  • 1
    Resource requests are actually off-topic for Stack Overflow. But if you search for any particular sampling method in R, you will find lots of examples. – Gregor Thomas May 04 '19 at 14:54
  • I suggest you to read the following document: https://stackoverflow.com/help/on-topic – Scipione Sarlo May 04 '19 at 15:17
  • @Gregor then suggest for stratified sampling and implementation in r – CrazyPanda May 04 '19 at 15:23
  • @ScipioneSarlo i know it . – CrazyPanda May 04 '19 at 15:25
  • 2
    Show what you have tried! Searching the [tag:r] tag for "stratified sample" gives 189 questions. Have you looked at any of them, tried any of them? [Here's the search results](https://stackoverflow.com/search?q=%5Br%5D+stratified+sample). What did you try, what didn't work, what more do you need? A request for a tutorial is not a good question for stack overflow. Get a data set. Try something. When you get stuck, share you data, share what you tried, and we will help get you the rest of the way there. – Gregor Thomas May 04 '19 at 18:42

1 Answers1

0

You can use caret package.

library(caret)
set.seed(3456)
trainIndex <- caret::createDataPartition(iris$Species, p = .8, # partition 80%~20%
                                         list = FALSE, 
                                         times = 1)

https://topepo.github.io/caret/data-splitting.html

But realize that StackOverflow is a place for sharing ideas and knowledge about codes, I suggest you check out the link below for best use.

How to make a great R reproducible example

bbiasi
  • 1,549
  • 2
  • 15
  • 31