brain_join: Join user data with a brain atlas

View source: R/brain_join.R

brain_joinR Documentation

Join user data with a brain atlas

Description

Performs a full join between user data and a brain atlas. Grouped data is handled automatically, producing one complete atlas per group.

Usage

brain_join(data, atlas, by = NULL)

Arguments

data

A data.frame with a column matching an atlas column (typically '"region"'). Can be grouped with [dplyr::group_by()].

atlas

A 'ggseg_atlas' object or data.frame containing atlas data.

by

Character vector of column names to join by. If 'NULL' (default), columns are detected automatically.

Value

An 'sf' object if the atlas contains geometry, otherwise a tibble.

Examples

someData <- data.frame(
  region = c(
    "transverse temporal", "insula",
    "precentral", "superior parietal"
  ),
  p = sample(seq(0, .5, .001), 4),
  stringsAsFactors = FALSE
)

brain_join(someData, dk())
brain_join(someData, dk(), "region")


ggseg documentation built on April 3, 2026, 5:06 p.m.