check-scalar-hasRownames | R Documentation |
Does the input have row names?
hasRownames(x)
x |
Object. |
TRUE
on success;
FALSE
on failure, with cause set.
Standard data.frame
class objects cannot have NULL
row names defined.
Here we are checking to see if a data.frame
has soft NULL
row names,
meaning that they return as a sequence that is identical to the number of
rows.
Updated 2022-12-14.
## TRUE ====
x <- data.frame(
"sample1" = c(1L, 2L),
"sample2" = c(3L, 4L),
row.names = c("gene1", "gene2")
)
print(x)
hasRownames(x)
## FALSE ====
x <- data.frame(a = seq_len(2L))
print(x)
# Standard data frame doesn't allow NULL row names.
rownames(x)
hasRownames(x)
x <- S4Vectors::DataFrame(a = seq_len(2L))
print(x)
# S4 data frame does allow NULL row names.
rownames(x)
hasRownames(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.