sub-sub-.CFDataset: Get a variable or axis object from a data set

[[.CFDatasetR Documentation

Get a variable or axis object from a data set

Description

This method can be used to retrieve a variable or axis from the data set by name.

Usage

## S3 method for class 'CFDataset'
x[[i]]

Arguments

x

An CFDataset to extract a variable or axis from.

i

The name of a variable or axis in x. If data set x has groups, i should be an absolute path to the object to retrieve.

Details

If the data set has groups, the name i of the variable or axis should be fully qualified with the path to the group where the object is located. This fully qualified name can be retrieved with the names() and dimnames() functions, respectively.

Value

An instance of CFVariable or an CFAxis descendant class, or NULL if the name is not found.

Examples

fn <- system.file("extdata", "ERA5land_Rwanda_20160101.nc", package = "ncdfCF")
ds <- open_ncdf(fn)
v1 <- names(ds)[1]
var <- ds[[v1]]
var

ncdfCF documentation built on April 16, 2025, 9:08 a.m.