Chapter01 {DanielBiostatistics10th} R Documentation

## Chapter 1

### Description

Functions and examples for Chapter 1, Introduction to Biostatistics.

### Usage

sampleRow(x, size, replace = FALSE, prob = NULL)


### Arguments

 x size positive integer scalar, number of rows to be selected replace logical scalar, whether sampling should be with replacement (default FALSE) prob numeric vector of probability weights for each row of input x being sampled. Default NULL indicates simple random sampling

### Value

Function sampleRow() returns a data.frame, a simple random sample from the input.

### References

Wayne W. Daniel, Biostatistics: A Foundation for Analysis in the Health Sciences, Tenth Edition. Wiley, ISBN: 978-1-119-62550-6.

### Examples

library(DanielBiostatistics10th)
# To run a line of code, use shortcut
# Command + Enter: Mac and RStudio Cloud
# Control + Enter: Windows, Mac and RStudio Cloud
# To clear the console
# Control + L: Mac and RStudio Cloud

# Page 8, Example 1.4.1
class(EXA_C01_S04_01) # EXA_C01_S04_01 is a 'data.frame' (a specific class defined in R)
dim(EXA_C01_S04_01) # dimension, number-row and number-column
head(EXA_C01_S04_01, n = 8L) # first n rows of a 'data.frame'
names(EXA_C01_S04_01) # column names of a 'data.frame'
EXA_C01_S04_01$AGE # use $ to obtain one column from a 'data.frame'
sampleRow(EXA_C01_S04_01, size = 10L, replace = FALSE) # to answer Example 1.4.1

# Page 11, Example 1.4.2
EXA_C01_S04_01[seq.int(from = 4L, to = 166L, by = 18L), ]


[Package DanielBiostatistics10th version 0.1.10 Index]