Description Usage Arguments Value Methods (by class)
Set index like python's DataFrame.set_index(,inplace=False) but works with data frames and character matrices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SetIndex(x, ...)
## Default S3 method:
SetIndex(x, index = colnames(x)[1])
## S3 method for class 'tbl_df'
SetIndex(x, ...)
ResetIndex(x, ...)
## S3 method for class 'data.frame'
ResetIndex(x, index = "index")
## S3 method for class 'matrix'
ResetIndex(x, ...)
|
x |
[data.frame or character matrix] table |
index |
[character] index number or name |
[data.frame or matrix]
default
: Sets row name to value of index
and removes index
from matix/data frame.
tbl_df
: Converts tibble object (which does not accept row names) to data frame before applying SetIndex.default
.
data.frame
: Reset index (like dplyr::add_rownames
or pandas DataFrame.reset_index(,inplace=False)
). Returns data frame with index in first position.
matrix
: Call as.data.frame on matrix and then apply ResetIndex.data.frame.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.