Skip to contents
  • columns_to_rownames(): Move a column of .data to its row names.

  • rownames_to_column(): Move the row names of .data to a new column.

  • remove_rownames(): Remove the row names of .data.

  • round_cols() Rounds the values of all numeric variables to the specified number of decimal places (default 2).

Usage

column_to_rownames(.data, var = "rowname")

rownames_to_column(.data, var = "rowname")

remove_rownames(.data)

round_cols(.data, digits = 2)

Arguments

.data

A data frame

var

Name of column to use for rownames.

digits

The number of significant figures. Defaults to 2.

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

# \donttest{
library(pliman)
iris2 <- iris |> rownames_to_column()
head(iris2)
#>   rowname Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1       1          5.1         3.5          1.4         0.2  setosa
#> 2       2          4.9         3.0          1.4         0.2  setosa
#> 3       3          4.7         3.2          1.3         0.2  setosa
#> 4       4          4.6         3.1          1.5         0.2  setosa
#> 5       5          5.0         3.6          1.4         0.2  setosa
#> 6       6          5.4         3.9          1.7         0.4  setosa
iris2$rowname <- paste0("r", iris2$rowname)
iris2 |> column_to_rownames("rowname") |> head()
#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> r1          5.1         3.5          1.4         0.2  setosa
#> r2          4.9         3.0          1.4         0.2  setosa
#> r3          4.7         3.2          1.3         0.2  setosa
#> r4          4.6         3.1          1.5         0.2  setosa
#> r5          5.0         3.6          1.4         0.2  setosa
#> r6          5.4         3.9          1.7         0.4  setosa
# }