File: hasAttributes.R

package info (click to toggle)
r-cran-bbmisc 1.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,256 kB
  • sloc: ansic: 176; sh: 9; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#' @title Check if given object has certain attributes
#'
#' @description
#' Checks whether an object has all specified attributes.
#'
#' @param obj [mixed]\cr
#'   Arbitrary R object.
#' @param attribute.names [\code{character}]\cr
#'   Vector of strings, i.e., attribute names.
#' @return [\code{logical(1)}]
#'   \code{TRUE} if object \code{x} contains all attributes from \code{attributeNames}
#'   and \code{FALSE} otherwise.
#' @export
hasAttributes = function(obj, attribute.names) {
  isSubset(attribute.names, getAttributeNames(obj))
}