cluster.sample {samplingR} | R Documentation |
Cluster sample for non-grouped data.
Description
Retrieves a sample of clusters for data which interest variable values
are not grouped by cluster.
Usage
cluster.sample(data, n, replace = FALSE)
Arguments
data |
Matrix or data.frame containing the population data in first column and the cluster it belongs to in the last column. |
n |
Number of clusters of the returning sample. |
replace |
Whether the sample to be taken can have repeated clusters or not. |
Details
#' If your data is grouped by cluster use srs.sample
function to retrieve
your sample. Remember grouped by cluster data must have interest variable data in the first column,
cluster size in the second and the cluster name in the last column. Interest
values of grouped data must reflect the total value of each cluster.
Value
Data frame of a clustered sample
Examples
data<-cbind(rnorm(500, 50, 20), rep(c(1:50),10))
sample<-cluster.sample(data, 10);sample
[Package samplingR version 1.0.1 Index]