Sets rownames to SubID

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 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

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

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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.