dfRownames: Sets rownames to SubID

Description Usage Arguments Value Author(s) Examples

Description

Sets the row names of the data frame to the variable name listed as SubID. SubID should be text name of variable. Also keeps number of characters constant by default (numeric SubID only) and removes SubID by default

Usage

1
dfRownames(Data, SubID = "SubID", FixedWidth = TRUE, Remove = TRUE, MaxNumDigits=NULL)

Arguments

Data

a data frame with a variable containing subject ID numbers

SubID

Text name of subject ID variable. Default is SubID

FixedWidth

logical. If TRUE (default), all rowames will be the same length by padding with leading 0's. Only applies to numeric SubIDs

Remove

logical. If TRUE (default), the subject ID variable will be removed from data frame after setting rownames

MaxNumDigits

Length of rowname string. If NULL, will be set to max length in data. Only applies to numeric SubIDs

Value

Returns data frame with rownames set (and SubID removed if requested)

Author(s)

John J. Curtin jjcurtin@wisc.edu

Examples

1
2
d <- data.frame(SubID = c(1,2,3,10,20), v1=c(1,2,3,4,5), v2=c(1,NA,NA,2,4), data=1:5)
d=dfRownames(d)

lmSupport documentation built on May 2, 2019, 2:14 p.m.