Learn R Programming

translateSPSS2R (version 1.0.0)

xpssSample: Creates a sample

Description

R Implementation of the SPSS SAMPLE argument. Takes a sample from a xpssFrame object, data frame or matrix.

Usage

xpssSample(x, pct = NULL, n = NULL, from = NULL)

Arguments

x
a (non-empty) data.frame or input data of class "xpssFrame".
pct
atomic numeric, determines the percentage to keep.
n
atomic numeric, specifies the number of cases to keep.
from
atomic numeric, indicates the Basis for n.

Value

Returns a subset of the actual dataset.

Details

xpssSample takes a sample of the specified size from the elements of x either with or without replacement. The subset get specified by pct or n.

pct specifies a percentage value, for the amount of data which should be kept, allowed value range is from 0.01 to 1. n indicates the amount of values to keep. from determines the basis for n. from has to be higher then n.

See Also

sample

Examples

Run this code
data(fromXPSS)

xpssSample(fromXPSS, pct = 0.5)

Run the code above in your browser using DataLab