Hi Guys
I have quick question if you have a spare minute.
I am using the function below named 'functionx'
function (data = data1, n0 = 1000, m = 5000)
{
xnamesls = makesubsets(data, maxsize = dim(data)[2])
M = length(xnamesls)
thetamls = mapply("factort", xnames = xnamesls, MoreArgs = list(data = data,
nu = nu, trainpct = trainpct, priorczz = priorczz, diag = diag,
n0 = n0, m = m), SIMPLIFY = FALSE)
outls = vector("list", M)
modnames = rep(0, M)
for (i in 1:M) {
logmargi = attr(thetamlsi, "logmarg")
outls[[i]] = list(xnames = xnamesls[[i]], logmarg = logmargi)
}
names(outls) = modnames
scandf = makedffrommscan(scanls = outls, data = data)
scandford = scandf[order(scandf$logmarg, decreasing = T),
]
scanls = list(scandf = scandf, scandford = scandford, scanls = outls)
return(scanls = scanls)
}
The object of interest is the highlighted 'scandf'.
However when I try to extract this function of interest using the below command:
scandf = functionx$scandf
I get the error ;
object of type 'closure' is not subsettable.
I see online this means I am treating the function like a data frame, but I am unsure how to correct this issue.
Do you guys know how to access an item within a function using $
, or is there a better way for me to do this?
Thanks in advance
Alan