firstRow: Extract First Row

Description Usage Arguments Details Value Author(s) Examples

Description

This function extracts the first row for each patient from a longform dataset, assuming patient identifiers are located in the first column of the dataset.

Usage

1
firstRow(ds, C = FALSE)

Arguments

ds

Longform dataset with patient IDs in first column.

C

Indicates inclusion of IGNORE=C column; if true, removes first column. Defaults to FALSE.

Details

This function was created for quickly plotting and running statistics on patient demographics. The function assumes the first column in ds contains patient identifiers ordered sequentially (i.e. no all rows for a single patient are grouped together). There is an optional logical variable C which is used to indicate the presence of an IGNORE column. This variable defaults to FALSE, but if this variable is TRUE, then this column will be removed.

Value

The first row for each patient are returned as a data.frame with all columns intact (except first comment column if C is TRUE).

Author(s)

Samuel Callisto calli055@umn.edu firstRow()

Examples

1
2
3
4
dataset <- data.frame(c(rep(1,4), rep(2,4), rep(3,4)), rep(LETTERS[1:4], 3), rep(letters[1:4],3))
names(dataset) <- c("SID", "cov1", "cov2")
output <- firstRow(dataset)
output

callistosp/dataTools documentation built on May 3, 2019, 4:31 p.m.