File: sample-methods.Rd

package info (click to toggle)
r-cran-memisc 0.99.31.8.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,136 kB
  • sloc: ansic: 5,117; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\name{sample-methods}
\alias{sample,data.frame-method}
\alias{sample,data.set-method}
\alias{sample,importer-method}
\title{Take a Sample from a Data Frame-like Object}
\description{
  The methods below are convenience short-cuts to
  take samples from data frames and data sets.
  They result in a data frame or data set, respectively,
  the rows of which are a sample of the complete
  data frame/data set.
}
\usage{
\S4method{sample}{data.frame}(x, size, replace = FALSE, prob = NULL)
\S4method{sample}{data.set}(x, size, replace = FALSE, prob = NULL)
\S4method{sample}{importer}(x, size, replace = FALSE, prob = NULL)
}
\arguments{
  \item{x}{a data frame or data set.}
  \item{size}{an (optional) numerical value, the sample size,
    defaults to the total number of rows of \code{x}.}
  \item{replace}{a logical value, determines whether
    sampling takes place with or without replacement.}
  \item{prob}{a vector of sampling probabities or NULL.}
}
\value{A data frame or data set.}

\examples{
for(.i in 1:4)
  print(sample(iris,5))
}