I'm trying to write a piece of software in R that finds the most fitting distribution family to a set of data by performing the chi-squared test on the data (with regards to said family) and finding the best chi-squared value.
However, when using the goodfit function, seemingly the only way to retrieve the chi-squared statistic is by running the function and using the summary(gf) command. This only results in a human-readable output, and I need something that I can draw in the form of gf$chisqvalue so that I can compare it to the results of the other tests I'm running. Is there any way to retrieve this statistic as a variable?