drawing of the sample

Hello dear
I want to make a sampling where I have to select 3 elements and the selection step is 2, i.e. for example if the first selected element is 4, I will have successively, 4+2=6, 6+2=8. my database is dneep

which program to write for that in R

Hi @mamady_rst,
I do hope that this question is not "homework". In addition, you will get better help more quickly in this forum if you at least post some R reproducible code that you have tried.
This code does the sort of operation you described, and the same logic will work for sampling the rows of a data frame (e.g. one imported from an external database).

aa <- rnorm(n=20, mean=10) # Some dummy data to sample from
start <- 4
step <- 2
freq <- 3
end <- (step*freq-1)+start 

sample_positions <- seq(from=start, to=end, by=step)
sample_positions

aa
aa[sample_positions]

HTH

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.