I am trying to modify the qgraph()
function in the r package qgraph to make some drastic changes to the graphical parameters. But before attempting these modifications, I have accessed the source code for the function and reloaded it as a new function (ie qgraph2()
) and run it on the big5 sample data. The error I receive reads could not find function "getArgs"
and I suspect getArgs to be a hidden function.
However, I cannot find getArgs() in the qgraph environment or the r global environment, and cannot find any record of it in any r documentation (?getArgs
, ??getArgs
), so I don't know where to call it from or how to find out that information. Moreover, I suspect there are more hidden functions lurking in the qgraph() function.
So my question is two-fold: firstly, how can I find out where getArgs() is hidden and access it accordingly, and secondly, is there a way to allow my modified function qgraph2 to access all such hidden objects without calling them individually.
Thank you.
If you know where your function is hidden you may use :::
operator to see it's code.
If you do not know this, use getAnywhere
. It will also tell you where function, you look for, is.
getAnywhere(getArgs)
A single object matching ‘getArgs’ was found
It was found in the following places
namespace:qgraph
with value
function (args)
{
if (length(args) > 0) {
isqgraph <- sapply(args, function(x) "qgraph" %in% class(x))
argLists <- c(lapply(args[isqgraph], "[[", "Arguments"),
lapply(args[isqgraph], "[", "layout"))
args <- args[!isqgraph]
newArgs <- lapply(argLists, getArgs)
for (l in newArgs) args <- c(args, l[!names(l) %in% names(args)])
}
return(args)
}
<bytecode: 0x000000001e900d50>
<environment: namespace:qgraph>
> qgraph:::getArgs
function (args)
{
if (length(args) > 0) {
isqgraph <- sapply(args, function(x) "qgraph" %in% class(x))
argLists <- c(lapply(args[isqgraph], "[[", "Arguments"),
lapply(args[isqgraph], "[", "layout"))
args <- args[!isqgraph]
newArgs <- lapply(argLists, getArgs)
for (l in newArgs) args <- c(args, l[!names(l) %in% names(args)])
}
return(args)
}
<bytecode: 0x000000001e900d50>
<environment: namespace:qgraph>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With