How to access a value of a "complicated" numeric type in R? -
i'm using mcnemar.test() function in r, in order examine statistics hypothesis. output list of type "htest". i.e:
mcnemartest<-mcnemar.test(my_data) browse[2]> mcnemartest mcnemar's chi-squared test data: data.matrix(contingencytable) mcnemar's chi-squared = 3.6, df = 1, p-value = 0.05778 browse[2]> class(mcnemartest) [1] "htest" my question concerns 2nd element of list, i.e mcnemartest[2]. list well.
browse[2]> class(mcnemartest[2]) [1] "list" browse[2]> class(mcnemartest[[2]]) [1] "numeric" browse[2]> mcnemartest[2] $parameter df 1 browse[2]> mcnemartest[[2]] df 1 my question is: how isolate value "1" in mcnemartest[[2]], , rid of "df" string?
thanks.
the 1 value there. it's named vector of length 1. value 1, name "df". can see this:
xx = mcnemartest$parameter length(xx) names(xx) if want rid of name,
xx = unname(xx) but things need do, unnaming isn't necessary.
Comments
Post a Comment