SlideShare a Scribd company logo
1 of 11
Sampling
Techniques
Introduction to R 1
Introduction to R 2
1. Simple Random Sampling
• Sampling from a vector or range of numbers
• Sampling with replacement
sample (c(1:10), size=3, replace=T)
• Sampling without replacement
sample (c(1:10), size=3, replace =F)
• “sampling” package can used for sampling in RStudio.
install.packages(“sampling”)
Introduction to R 3
• Randomly selecting rows from a dataset
Method 1 : Here the sample function in r is used to
select a random subset of 5 rows from a
large data frame.
Syntax – Dataset_name [row_no,coloumn_no]
>Data1[sample(nrow(Data1), 5), ]
>Data1[sample(nrow(Data1), 5),c(1,3,5) ]
Introduction to R 4
Method 2 : Using dplyr package
>install.packages(“dplyr”)
>library(dplyr)
Syntax –
Dataset_name[row_no,coloumn_no]
>sample_n(Data1, 10)
(Can be used “replace” function at
anytime)
Introduction to R 5
2. Stratified Sampling
Syntax :
> strata(data, stratanames, size, method=, description)
data - data frame
Stratanames - stratification variable
size - vector of stratum sample sizes
method - method to select units
(simple random sampling without replacement (srswor)
or simple random sampling with replacement (srswr))
description - a message is printed if its value is TRUE
(the message gives the number of selected units and
the number of the units in the population)
Introduction to R 6
Example
>Stratified <- strata(Data1,
stratanames = c("Sex"),
size = c(50,50),method = 'srswor',
description = TRUE)
> Stratified
To obtain the sample data frame
>Stratified_sample<getdata(Data1,
Stratified)
>Stratified_sample
Introduction to R 7
3. Cluster Sampling
Syntax :
> cluster(data, clustername, size, method, description)
data - data frame
clustername - clustering variable
size - sample size
method - method to select clusters
(simple random sampling without replacement (srswor)
or simple random sampling with replacement (srswr))
description - a message is printed if its value is TRUE
the message gives the number of selected units and the
number of the units in the population
Introduction to R 8
Example
>Clustered1<-cluster(Data1,
clustername = c("Sex"),size = 1,
method ='srswor',description = TRUE)
> Clustered1
To obtain the sample data frame
>Clustered1_sample1<-getdata(Data1,
Clustered1)
> Clustered1_sample1
Introduction to R 9
Systematic Sampling
Functions in R
A function is a set of statements organized together to
perform a specific task.
Execute the function with necessary parameters.
Syntax :
function_name=function(par1,par2,....)
{
..........
}
Introduction to R 10
Eg:
To find mean of a sequence with a given starting value
>Seq(from, to, by)
from – starting value
to – ending value
by – increment of the sequence
Introduction to R 11
> sys.sample<-function(N,n){
k=floor(N/n)
r=sample(1:k,1)
sys.sample=seq(r,r+k*(n-1),k)
print(sys.sample)
}
Syntax: sys.sample(N,n)
> sys.sample(4177,100)
To obtain the sample dataframe
>systematic_sample<-Data1[sys.sample
(4177,100),]
> systematic_sample

More Related Content

What's hot

Day 1d R structures & objects: matrices and data frames.pptx
Day 1d   R structures & objects: matrices and data frames.pptxDay 1d   R structures & objects: matrices and data frames.pptx
Day 1d R structures & objects: matrices and data frames.pptxAdrien Melquiond
 
Time series representations for better data mining
Time series representations for better data miningTime series representations for better data mining
Time series representations for better data miningPeter Laurinec
 
Day 1b R structures objects.pptx
Day 1b   R structures   objects.pptxDay 1b   R structures   objects.pptx
Day 1b R structures objects.pptxAdrien Melquiond
 
Data Visualization using base graphics
Data Visualization using base graphicsData Visualization using base graphics
Data Visualization using base graphicsRupak Roy
 
Array in c programming
Array in c programmingArray in c programming
Array in c programmingManojkumar C
 
Array in c programming
Array in c programmingArray in c programming
Array in c programmingMazharul Islam
 
Pointers and Dynamic Memory Allocation
Pointers and Dynamic Memory AllocationPointers and Dynamic Memory Allocation
Pointers and Dynamic Memory AllocationRabin BK
 
Transpose and manipulate character strings
Transpose and manipulate character strings Transpose and manipulate character strings
Transpose and manipulate character strings Rupak Roy
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array pptsandhya yadav
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programmingSajid Hasan
 
Array in c language
Array in c languageArray in c language
Array in c languageumesh patil
 

What's hot (20)

Day 1d R structures & objects: matrices and data frames.pptx
Day 1d   R structures & objects: matrices and data frames.pptxDay 1d   R structures & objects: matrices and data frames.pptx
Day 1d R structures & objects: matrices and data frames.pptx
 
Time series representations for better data mining
Time series representations for better data miningTime series representations for better data mining
Time series representations for better data mining
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
 
Day 1b R structures objects.pptx
Day 1b   R structures   objects.pptxDay 1b   R structures   objects.pptx
Day 1b R structures objects.pptx
 
Data Visualization using base graphics
Data Visualization using base graphicsData Visualization using base graphics
Data Visualization using base graphics
 
Array
ArrayArray
Array
 
Day 2b i/o.pptx
Day 2b   i/o.pptxDay 2b   i/o.pptx
Day 2b i/o.pptx
 
Chap1 array
Chap1 arrayChap1 array
Chap1 array
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
7.basic array
7.basic array7.basic array
7.basic array
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
Pointers and Dynamic Memory Allocation
Pointers and Dynamic Memory AllocationPointers and Dynamic Memory Allocation
Pointers and Dynamic Memory Allocation
 
Transpose and manipulate character strings
Transpose and manipulate character strings Transpose and manipulate character strings
Transpose and manipulate character strings
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Array in c
Array in cArray in c
Array in c
 
arrays of structures
arrays of structuresarrays of structures
arrays of structures
 
Array in C
Array in CArray in C
Array in C
 
Arrays
ArraysArrays
Arrays
 

Similar to Sampling Techniques.pptx

MODULE 5- EDA.pptx
MODULE 5- EDA.pptxMODULE 5- EDA.pptx
MODULE 5- EDA.pptxnikshaikh786
 
Clustering and Visualisation using R programming
Clustering and Visualisation using R programmingClustering and Visualisation using R programming
Clustering and Visualisation using R programmingNixon Mendez
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Raman Kannan
 
Collection frame work
Collection  frame workCollection  frame work
Collection frame workRahul Kolluri
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIIMax Kleiner
 
arrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdfarrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdfMarlonMagtibay2
 
More Stored Procedures and MUMPS for DivConq
More Stored Procedures and  MUMPS for DivConqMore Stored Procedures and  MUMPS for DivConq
More Stored Procedures and MUMPS for DivConqeTimeline, LLC
 
Machine Learning With R
Machine Learning With RMachine Learning With R
Machine Learning With RDavid Chiu
 
NumPy_Broadcasting Data Science - Python.pptx
NumPy_Broadcasting Data Science - Python.pptxNumPy_Broadcasting Data Science - Python.pptx
NumPy_Broadcasting Data Science - Python.pptxJohnWilliam111370
 
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN Cnaveed jamali
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arraysAseelhalees
 

Similar to Sampling Techniques.pptx (20)

MODULE 5- EDA.pptx
MODULE 5- EDA.pptxMODULE 5- EDA.pptx
MODULE 5- EDA.pptx
 
R and data mining
R and data miningR and data mining
R and data mining
 
Clustering and Visualisation using R programming
Clustering and Visualisation using R programmingClustering and Visualisation using R programming
Clustering and Visualisation using R programming
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
 
Collection frame work
Collection  frame workCollection  frame work
Collection frame work
 
Arrays
ArraysArrays
Arrays
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
 
arrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdfarrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdf
 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
 
More Stored Procedures and MUMPS for DivConq
More Stored Procedures and  MUMPS for DivConqMore Stored Procedures and  MUMPS for DivConq
More Stored Procedures and MUMPS for DivConq
 
Machine Learning With R
Machine Learning With RMachine Learning With R
Machine Learning With R
 
07+08slide.pptx
07+08slide.pptx07+08slide.pptx
07+08slide.pptx
 
Arrays 06.ppt
Arrays 06.pptArrays 06.ppt
Arrays 06.ppt
 
NumPy_Broadcasting Data Science - Python.pptx
NumPy_Broadcasting Data Science - Python.pptxNumPy_Broadcasting Data Science - Python.pptx
NumPy_Broadcasting Data Science - Python.pptx
 
Array,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN CArray,MULTI ARRAY, IN C
Array,MULTI ARRAY, IN C
 
Multi dimensional arrays
Multi dimensional arraysMulti dimensional arrays
Multi dimensional arrays
 
R programming
R programmingR programming
R programming
 
Descriptive Statistics in R.pptx
Descriptive Statistics in R.pptxDescriptive Statistics in R.pptx
Descriptive Statistics in R.pptx
 
Chap 6 c++
Chap 6 c++Chap 6 c++
Chap 6 c++
 

Recently uploaded

Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...anilsa9823
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxWorkforce Group
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Dipal Arora
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insightsseri bangash
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsMichael W. Hawkins
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfOnline Income Engine
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...Suhani Kapoor
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetDenis Gagné
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst SummitHolger Mueller
 
A305_A2_file_Batkhuu progress report.pdf
A305_A2_file_Batkhuu progress report.pdfA305_A2_file_Batkhuu progress report.pdf
A305_A2_file_Batkhuu progress report.pdftbatkhuu1
 

Recently uploaded (20)

Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insights
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
HONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael HawkinsHONOR Veterans Event Keynote by Michael Hawkins
HONOR Veterans Event Keynote by Michael Hawkins
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
 
Unlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdfUnlocking the Secrets of Affiliate Marketing.pdf
Unlocking the Secrets of Affiliate Marketing.pdf
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
VIP Call Girls Gandi Maisamma ( Hyderabad ) Phone 8250192130 | ₹5k To 25k Wit...
 
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature SetCreating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
Creating Low-Code Loan Applications using the Trisotech Mortgage Feature Set
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst Summit
 
A305_A2_file_Batkhuu progress report.pdf
A305_A2_file_Batkhuu progress report.pdfA305_A2_file_Batkhuu progress report.pdf
A305_A2_file_Batkhuu progress report.pdf
 

Sampling Techniques.pptx

  • 2. Introduction to R 2 1. Simple Random Sampling • Sampling from a vector or range of numbers • Sampling with replacement sample (c(1:10), size=3, replace=T) • Sampling without replacement sample (c(1:10), size=3, replace =F) • “sampling” package can used for sampling in RStudio. install.packages(“sampling”)
  • 3. Introduction to R 3 • Randomly selecting rows from a dataset Method 1 : Here the sample function in r is used to select a random subset of 5 rows from a large data frame. Syntax – Dataset_name [row_no,coloumn_no] >Data1[sample(nrow(Data1), 5), ] >Data1[sample(nrow(Data1), 5),c(1,3,5) ]
  • 4. Introduction to R 4 Method 2 : Using dplyr package >install.packages(“dplyr”) >library(dplyr) Syntax – Dataset_name[row_no,coloumn_no] >sample_n(Data1, 10) (Can be used “replace” function at anytime)
  • 5. Introduction to R 5 2. Stratified Sampling Syntax : > strata(data, stratanames, size, method=, description) data - data frame Stratanames - stratification variable size - vector of stratum sample sizes method - method to select units (simple random sampling without replacement (srswor) or simple random sampling with replacement (srswr)) description - a message is printed if its value is TRUE (the message gives the number of selected units and the number of the units in the population)
  • 6. Introduction to R 6 Example >Stratified <- strata(Data1, stratanames = c("Sex"), size = c(50,50),method = 'srswor', description = TRUE) > Stratified To obtain the sample data frame >Stratified_sample<getdata(Data1, Stratified) >Stratified_sample
  • 7. Introduction to R 7 3. Cluster Sampling Syntax : > cluster(data, clustername, size, method, description) data - data frame clustername - clustering variable size - sample size method - method to select clusters (simple random sampling without replacement (srswor) or simple random sampling with replacement (srswr)) description - a message is printed if its value is TRUE the message gives the number of selected units and the number of the units in the population
  • 8. Introduction to R 8 Example >Clustered1<-cluster(Data1, clustername = c("Sex"),size = 1, method ='srswor',description = TRUE) > Clustered1 To obtain the sample data frame >Clustered1_sample1<-getdata(Data1, Clustered1) > Clustered1_sample1
  • 9. Introduction to R 9 Systematic Sampling Functions in R A function is a set of statements organized together to perform a specific task. Execute the function with necessary parameters. Syntax : function_name=function(par1,par2,....) { .......... }
  • 10. Introduction to R 10 Eg: To find mean of a sequence with a given starting value >Seq(from, to, by) from – starting value to – ending value by – increment of the sequence
  • 11. Introduction to R 11 > sys.sample<-function(N,n){ k=floor(N/n) r=sample(1:k,1) sys.sample=seq(r,r+k*(n-1),k) print(sys.sample) } Syntax: sys.sample(N,n) > sys.sample(4177,100) To obtain the sample dataframe >systematic_sample<-Data1[sys.sample (4177,100),] > systematic_sample