grapes-1-grapes: first valid item in data object

%1%R Documentation

first valid item in data object

Description

Returns the first item in list/data.frame x that is TRUE according to l, where l is a logical vector. This is similar to dplyr::first The vector l describes some previously established condition for the list.

Usage

x %1% l

Arguments

x

list or data.frame

l

the result of some condition (appropriate for x)

Details

if x is a data.frame, return the first column that is labeled as TRUE by l.

Value

the first item in x that has a TRUE l value

Examples

> x <- list(a=data.frame(x=c(0,1),y=c(100,128)),b=data.frame(x=c(1,2),y=c(128,200)))
> l <- grepl('[bB]',names(x))
> m <- grepl('[yY]',names(x[[1]]))
> x %1% l %1% m
[1] 128 200

a-kramer/SBtabVFGEN documentation built on Dec. 15, 2024, 1:52 a.m.