% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/y_columns.R
\name{columns}
\alias{columns}
\alias{list_columns}
\alias{remove_columns}
\alias{add_column}
\alias{move_column}
\alias{select_column}
\alias{update_column}
\title{Update columns in your metadata}
\usage{
list_columns(x)

remove_columns(x, id)

add_column(x, id, ..., .pos = length(x[["columns"]]) + 1L)

move_column(x, id, .pos = length(x[["columns"]]))

select_column(x, id)

update_column(x, id, ...)
}
\arguments{
\item{x}{\code{mighty_domain()} Object to manipulate.}

\item{id}{\code{character()} Id of the column(s) to remove, add, or move.}

\item{...}{Additional properties to add/update for the column, e.g. a \code{label = "my label"}.}

\item{.pos}{\code{integer(1)} Position to put or move the column to. Default places the column as the last.}
}
\value{
\code{invisible(x)}
}
\description{
Functions to list, select, remove, add, update, and move columns in
your \code{mighty_domain()} objects.
}
\examples{
# Load example configuration
x <- mighty_domain(
  file = system.file("examples", "advs.yml", package = "mighty.metadata")
)

# List all columns defined
list_columns(x)

# Remove the STUDYID and USUBJID columns
x |>
  remove_columns(c("STUDYID", "USUBJID")) |>
  list_columns()

# Add a new column
x |>
  add_column(id = "NEW") |>
  list_columns()

# Add new column with label and as the first column
y <- x |>
  add_column(id = "NEW", label = "My label", .pos = 1)

list_columns(y)

y[["columns"]][[1]] |>
  str()

# Move the STUDYID column to the 3rd position
x |>
  move_column(id = "STUDYID", .pos = 3) |>
  list_columns()

# Update an existing column
x |>
  update_column(id = "STUDYID", label = "Updated Label") |>
  select_column(id = "STUDYID") |>
  str()

# Select a specific column
select_column(x, id = "STUDYID") |>
  str()

}
