shift.rownames {reader} | R Documentation |
Checks whether the first column looks like IDs, and if so will. remove the column, and move these values to rownames.
shift.rownames(dataf, override = FALSE, warn = FALSE)
dataf |
data.frame to run the conversion on |
override |
assume col 1 is rownames, regardless of numeric() test |
warn |
whether to display warnings if assumptions aren't met |
returns vectors of strings of char, lengths X
Nicholas Cooper nick.cooper@cimr.cam.ac.uk
df1 <- data.frame(ID=paste("ID",101:110,sep=""), scores=sample(70,10,TRUE)+30,age=sample(7,10,TRUE)+11) shift.rownames(df1) df2 <- data.frame(ID=paste(101:110), scores=sample(70,10,TRUE)+30,age=sample(7,10,TRUE)+11) shift.rownames(df2) # first col are all numbers, so no convert shift.rownames(df2,override=TRUE) # override forces conversion