Skip to contents

Change the order of columns in the active metadata component.

Usage

# S3 method for class 'tidymatrix'
relocate(.data, ..., .before = NULL, .after = NULL)

Arguments

.data

A tidymatrix object

...

Columns to move

.before

Column to move before

.after

Column to move after

Value

A tidymatrix object with reordered metadata columns

Examples

library(dplyr, warn.conflicts = FALSE)
tm <- tidymatrix(big5_responses, big5_respondents, big5_items)

tm |>
  activate(rows) |>
  relocate(country, .after = respondent_id)
#> # A tidymatrix: 400 x 30 matrix
#> # Active: rows
#> #
#> # Row data: 400 rows x 8 columns
#> # Column data: 30 rows x 5 columns
#> #
#> # Active data (rows):
#>   respondent_id country age gender education     occupation life_satisfaction
#> 1          R001      EE  52 Female Secondary Service/Manual                 8
#> 2          R002      FI  32 Female    Master         Office                 4
#> 3          R003      EE  66   Male  Bachelor         Office                 6
#> 4          R004      EE  42   Male  Bachelor   Professional                 9
#> 5          R005      FI  48 Female Secondary         Office                 8
#> 6          R006      EE  62 Female     Basic Service/Manual                 4
#>   completion_min
#> 1           19.8
#> 2            6.2
#> 3            6.3
#> 4            9.7
#> 5           14.2
#> 6           11.6