How to rename a line?

Asked

Viewed 27 times

-1

I have the table:

                                   [,1]
Inconclusivo ou indeterminado  1.229142
Negativo                      60.131108
Null                          11.536551
Positivo                      27.103198

I would like to rename the line Null.

  • Hello Cleonice, welcome to Sopt. Please edit your question to include the output of the command dput for your object with the table. See this post for details on how to do this.

1 answer

1

Can use row.names with logical indexing to identify the line named "Null". Since you did not provide your data in a reproducible format, I am creating a simple example:

# matriz de exemplo
tabela <- matrix(1:3, dimnames = list(c("A", "Null", "C")))

tabela
#>      [,1]
#> A       1
#> Null    2
#> D       3

row.names(tabela)[row.names(tabela) == "Null"] <- "B"

tabela
#>   [,1]
#> A    1
#> B    2
#> C    3

Browser other questions tagged

You are not signed in. Login or sign up in order to post.