R/cdfGetFields.R
096f7f6a
 ########################################################################/**
 # @RdocFunction cdfGetFields
 #
 # @title "Gets a subset of groups fields in a CDF structure"
 #
 # \description{
 #  @get "title".
 #
37be88b0
 #  This @function is designed to be used with @see "applyCdfGroups".
096f7f6a
 # }
 #
 # @synopsis
 #
 # \arguments{
 #  \item{groups}{A @list of groups.}
 #  \item{fields}{A @character @vector of names of fields to be returned.}
 #  \item{...}{Not used.}
 # }
 #
 # \value{
 #  Returns a @list structure of groups.
 # }
 #
 # \details{
7d16a177
 #   Note that an error is \emph{not} generated for missing fields.
096f7f6a
 #   Instead the field is returned with value @NA.  The reason for this
 #   is that it is much faster.
 # }
 #
 # \seealso{
 #  @see "applyCdfGroups".
 # }
 #
76cf4b26
 # @author "HB"
096f7f6a
 #
 # @keyword programming
f1d6fcf0
 # @keyword internal
096f7f6a
 #**/#######################################################################
 cdfGetFields <- function(groups, fields, ...) {
f1d6fcf0
   lapply(groups, function(group) .subset(group, fields))
096f7f6a
 }
 
 ############################################################################
 # HISTORY:
7d16a177
 # 2006-03-21 (Stockholm, Sveavagen)
096f7f6a
 # o Created.
7d16a177
 ############################################################################