Extract.findFn: Subset a findFn object

Extract.findFnR Documentation

Subset a findFn object

Description

Extract rows from a findFn object

Usage

## S3 method for class 'findFn'
x[i, j,
    drop = 
    if (missing(i)) TRUE else length(j) == 1]

Arguments

x

An object of class findFn

i

a valid object to select rows of x, e.g., a vector of all positive integers or all negative integers between 1 and nrow(x) or a logical vector of length nrow(x).

j

If not missing, the extraction function returns an object of class data.frame rather than findFn.

drop

logical: if FALSE and j selects only one column, return that column as a vector; else return a data.frame if j is present or a findFn object otherwise.

Details

1. if(missing(j)) extract the subset with the PackageSummary attribute recomputed on the subset.

2. else return(Extract.data.frame(x, i, j, drop))

Value

If j is missing, return an object of class c('findFn', 'data.frame') else return whatever is returned by Extract.data.frame.

Author(s)

Spencer Graves

See Also

findFn, data.frame

Examples

  z <- try(findFn("spline", maxPages = 2))
  
  if(!inherits(z, "try-error")){
# one row
  z1 <- z[1,]

# one column 
  z.2 <- z[, 2]
# 
  z.2a <- z[2]
  
    all.equal(z.2, z.2a)
  
# data.frame with one column
  z.2d <- z[, 2, drop=FALSE]
  }

sos documentation built on June 30, 2024, 1:06 a.m.