search_fun <- function(fct) {
# vector with sub-packages
spatstat_packages <- c("spatstat.utils", "spatstat.data", "spatstat.sparse",
"spatstat.geom", "spatstat.core", "spatstat.linnet")
# get namespace of all sub-packages
full_namespace <- lapply(spatstat_packages, function(i) cbind(getNamespaceExports(i), i))
# combine to one matrix
full_namespace <- do.call(what = rbind, args = full_namespace)
# return only rows with functions
result <- matrix(full_namespace[full_namespace[, 1] %in% fct, ], ncol = 2)
return(result)
}