transmute.Spat: Create, modify, and delete cell values/layers/attributes of...

transmute.SpatR Documentation

Create, modify, and delete cell values/layers/attributes of ⁠Spat*⁠ objects

Description

[Superseded]

transmute() creates a new object containing only the specified computations. It's superseded because you can perform the same job with mutate(.keep = "none").

Usage

## S3 method for class 'SpatRaster'
transmute(.data, ...)

## S3 method for class 'SpatVector'
transmute(.data, ...)

Arguments

.data

A SpatRaster created with terra::rast() or a SpatVector created with terra::vect().

...

<data-masking> Name-value pairs. The name gives the name of the column in the output.

The value can be:

  • A vector of length 1, which will be recycled to the correct length.

  • A vector the same length as the current group (or the whole data frame if ungrouped).

  • NULL, to remove the column.

  • A data frame or tibble, to create multiple columns in the output.

Value

A ⁠Spat*⁠ object of the same class than .data. See Methods.

Methods

Implementation of the generic dplyr::transmute() method.

See Also

mutate.Spat, dplyr::transmute() methods.

Examples

library(terra)

# SpatVector method
f <- system.file("extdata/cyl.gpkg", package = "tidyterra")
v <- vect(f)

v |>
  transmute(cpro2 = paste0(cpro, "-CyL"))

tidyterra documentation built on March 11, 2026, 9:08 a.m.