# [R] Identifying Package for Function

B77S bps0002 at auburn.edu
Fri Sep 23 01:23:09 CEST 2011

```Where is dropvalue(s) mentioned?

>  ?subset

subset: logical expression indicating elements or rows to keep:
missing values are taken as false.

select: expression, indicating columns to select from a data frame.

drop: passed on to ‘[’ indexing operator.

...: further arguments to be passed to or from other methods.

Details:

This is a generic function, with methods supplied for matrices,
data frames and vectors (including lists).  Packages and users can

For ordinary vectors, the result is simply ‘x[subset &
!is.na(subset)]’.

For data frames, the ‘subset’ argument works on the rows.  Note
that ‘subset’ will be evaluated in the data frame, so columns can
be referred to (by name) as variables in the expression (see the
examples).

The ‘select’ argument exists only for the methods for data frames
and matrices.  It works by first replacing column names in the
selection expression with the corresponding column numbers in the
data frame and then using the resulting integer vector to index
the columns.  This allows the use of the standard indexing
conventions so that for example ranges of columns can be specified
easily, or single columns can be dropped (see the examples).

The ‘drop’ argument is passed on to the indexing method for
matrices and data frames: note that the default for matrices is
different from that for indexing.

Value:

An object similar to ‘x’ contain just the selected elements (for a
vector), rows and columns (for a matrix or data frame), and so on.

Author(s):

Peter Dalgaard and Brian Ripley

‘[’, ‘transform’

Examples:

subset(airquality, Temp > 80, select = c(Ozone, Temp))
subset(airquality, Day == 1, select = -Temp)
subset(airquality, select = Ozone:Wind)

with(airquality, subset(Ozone, Temp > 80))

## sometimes requiring a logical 'subset' argument is a nuisance
nm <- rownames(state.x77)
start_with_M <- nm %in% grep("^M", nm, value=TRUE)
subset(state.x77, start_with_M, Illiteracy:Murder)

Rich Shepard wrote:
>
> While reading ?subset I'm referred to learn about dropvalues() as a
> following operation. Yet, when I issue ?dropvalue I see, "No documentation
> for '?dropvalues' in specified packages and libraries:".
>
>    How do I identify the library/package that contains a specific function
> such as, in this case, dropvalues()?
>
> Rich
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help