Skip to contents

Returns TRUE if package has data.frame. If package is not installed, install with install.packages(dependencies = TRUE).

  1. Check if the package is installed and load it

  2. Retrieve the objects in the package

  3. Use purrr::map_lgl() to apply is.data.frame() to each object in the package. map_lgl() returns a logical vector with the same length as the retrieved package objects.

Usage

check_df_in_pkg(pkg)

Arguments

pkg

name of package (a character vector)

Value

logical (TRUE = has data.frame, FALSE = no data.frame)

See also

Examples

check_df_in_pkg("dplyr")
#> [1] TRUE
check_df_in_pkg("stringr")
#> Loading required package: stringr
#> [1] FALSE