TDeramus
TDeramus

Reputation: 160

Pulling a specific output from a function using sapply?

I'm looking to run the fitDist function on columns in a dataframe using sapply and save the output to a dataframe, using something like the following:

data.frame(sapply(df, fitDist))

Run singularly, fitDist outputs it's results as a list:

output$family
output$parameters
output$type
output$call
output$y
output$weights
output$G.deviance
output$N
output$df.fit
output$df.residual
output$aic
output$sbc
output$method
output$vcov
output$Allpar
output$mu
output$mu.link
output$sigma
output$sigma.coefficients
output$sigma.link
output$nu
output$nu.coefficients
output$nu.link
output$tau
output$tau.coefficients
output$tau.link
output$residuals
output$rqres
output$failed
output$fits

However, all I really need from the output is the second value from output$family[2] ["Exponential generalized beta 2 (i.e. of the second kind)"], but I'm not sure how to adjust the sapply call to return just this value.

Any suggestions on how adjust the command so that it only produces a dataframe that returns this value would be greatly appreciated.

Upvotes: 0

Views: 52

Answers (0)

Related Questions