accessors: Accessors to a cubble object

[.spatial_cubble_dfR Documentation

Accessors to a cubble object

Description

Accessors to a cubble object

Usage

## S3 method for class 'spatial_cubble_df'
data[i, j, drop = FALSE]

## S3 method for class 'temporal_cubble_df'
data[i, j, drop = FALSE]

## S3 replacement method for class 'spatial_cubble_df'
names(x) <- value

## S3 replacement method for class 'temporal_cubble_df'
names(x) <- value

## S3 replacement method for class 'cubble_df'
x[[i]] <- value

Arguments

data

an object of class spatial_cubble_df or temporal_cubble_df

i, j

row and column selector

drop

logical. If TRUE the result is coerced to the lowest possible dimension. The default is to drop if only one column is left, but not to drop if only one row is left.

x

data frame.

value

a suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the Coercion section. If NULL, deletes the column if a single column is selected.

Details

For nested cubbles, [ will return a cubble object if the key variable, thecoords variables, and the ts column all present. If the cubble object is also an sf object, the sticky select behavior on the sf column will preserve. For long cubbles, [ will return a cubble object if the key and index variable both present. When a cubble can't be created and the data is not an sf class, [ will always return a tibble, even with single index selection.

Examples

climate_mel[c(1:3, 7)] # a nested cubble
make_spatial_sf(climate_mel)[1:3] # an sf

long <- climate_mel |> face_temporal()
long[1:3] # a long cubble

climate_mel[1:3] # tibble
long[2:5] # tibble
climate_mel[1] # still tibble
long[1] # and still tibble

cubble documentation built on Sept. 11, 2024, 7:19 p.m.