Reputation: 625
I am doing a chisq.test and trying to assign the output to a variable.
> Output <- chisq.test(test[,k], test[,l])
> Output
Pearson's Chi-squared test
data: test[, k] and test[, l]
X-squared = 7128, df = 36, p-value < 2.2e-16
I want to access the p-value alone from the output or assign p-value alone to the ouptut.
Is there a way like:
Output$p-value
using which i can access the p-value alone? I dont want the rest of the information like df, X-squared values in the output.
Upvotes: 2
Views: 6630
Reputation: 6740
output$p.value
Open the help ?chisq.test
, and refer to the Value section. It tells you what outcome is given by the function.
You can also try
names(output)
to find the component names.
Upvotes: 7