Lets say I have package base
, dplyr
, data.table
, tidyr
etc. loaded using sapply()
.
sapply(c
Thanks to all. So here are Answers in 3 Versions to the question I posted with all the help here
Note: The priority was to search for a pattern over multiple loaded packages, you can search some other pattern instead of "is."
VERSION 1
## Get list of loaded packages into X
X <- grep('package:',search(),value=TRUE) # Comment by danielson
# Use grep to find functions with is. pattern over multiple loaded packages inside X
sapply(X, function(X) {
paste0(X, ":", grep("is\\.", ls(X),value=TRUE))
})
VERSION 2
## Get list of loaded packages into X
X <- .packages() # Comment by docendo discimus
# Use grep to find functions with is. pattern over multiple loaded packages inside X
sapply(X, function(X) {
paste0(X, ":", grep("is\\.", ls(paste0("package:",X)),value=TRUE))
})
VERSION 3 - Without grep() function
## Get list of loaded packages into X
X <- .packages()
# find functions using `ls()` with is. pattern over multiple loaded packages inside X
# Suggested by Rich Scriven Over Comments
sapply(X, function(X) {
paste0(X,":",ls(paste0("package:",X), pattern = "is\\."))
})