Description Usage Arguments Value Author(s) See Also Examples
Checks whether the first column looks like IDs, and if so will. remove the column, and move these values to rownames.
1 | 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
1 2 3 4 5 6 7 | 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
|
Loading required package: NCmisc
Attaching package: ‘reader’
The following objects are masked from ‘package:NCmisc’:
cat.path, get.ext, rmv.ext
scores age
ID101 45 13
ID102 60 16
ID103 38 12
ID104 63 18
ID105 39 12
ID106 35 13
ID107 61 14
ID108 56 16
ID109 35 14
ID110 74 14
scores age
101 44 17
102 76 13
103 78 15
104 33 13
105 83 17
106 51 15
107 74 14
108 84 16
109 43 14
110 57 15
scores age
101 44 17
102 76 13
103 78 15
104 33 13
105 83 17
106 51 15
107 74 14
108 84 16
109 43 14
110 57 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.