%1% | R Documentation |
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.
x %1% l
x |
list or data.frame |
l |
the result of some condition (appropriate for x) |
if x is a data.frame, return the first column that is labeled as TRUE by l.
the first item in x that has a TRUE l value
> 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.