I'm trying to access individual elements of an object returned from TukeyHSD function. I can see how to access the individual elements, but how do I access the labels?
$`Auto$CargoSpace`
diff lwr upr p adj
wagon-SUV -3747.333 -7664.507 -980.0801 6.855348e-03
trunk-SUV -4792.333 -5621.311 -2371.3357 2.065806e-05
trunk-wagon -968.000 -3823.523 2125.54328 7.410039e-01
I'd like to be able to access each row/column combination the way I can with a tibble or dataframe. That way I can add an interpretation later in the code. Let's say I wanted to end up with this result:
CargoSpace p adj Analysis
wagon-SUV 6.85 Unlikely to produce a benefit
trunk-SUV 2.06 Worth investigating
We extract the output with
$
, then use eithergrep
(if partial matches) or%in%
(for fixed matching) to subset the rows, create adata.frame
with the row names of the subset of the dataset along with "p adj" column. Then, we can create 'Analysis' column based on the value of 'p.adj'Reproducible example