On 23/01/2012, at 13:31 PM, Nevil Amos wrote:
> I have an anova.cca() output.
>
> If it is possible I would like to extract the table it contains as a data
frame
> ie
>>> myAnova
>> Permutation test for rda under reduced model
>> Terms added sequentially (first to last)
>>
>> Model: rda(formula = mygenind at tab ~ mds3dCS_NULL +
mds3dTRE_25_2_CS25 + mydata$LAT.x + mydata$LONG.x + mydata$Hab_Config +
mds3dTRE_25_100_CS25 + mydata$TreeCov + mydata$Site_No + mds3dSFW_EO_100_CS25 +
mds3dSFW_EO_5000_CS25 + mydata$Landscape + mds3dSFW_TH_10_CS25, scale = T,
na.action = "na.omit")
>> Df Var F N.Perm Pr(>F)
>> mds3dCS_NULL 3 6.527 2.6380 99 0.01 **
>> mds3dTRE_25_2_CS25 3 5.596 2.2616 99 0.01 **
>> mydata$LAT.x 1 1.892 2.2939 99 0.01 **
>> mydata$LONG.x 1 1.891 2.2929 99 0.01 **
>> mydata$Hab_Config 2 2.772 1.6807 99 0.01 **
>> mds3dTRE_25_100_CS25 3 3.952 1.5970 99 0.01 **
>> mydata$TreeCov 1 1.272 1.5418 99 0.01 **
>> mydata$Site_No 1 1.345 1.6306 99 0.01 **
>> mds3dSFW_EO_100_CS25 3 3.741 1.5120 99 0.01 **
>> mds3dSFW_EO_5000_CS25 3 3.410 1.3783 99 0.01 **
>> mydata$Landscape 8 9.300 1.4094 99 0.01 **
>> mds3dSFW_TH_10_CS25 3 3.658 1.4785 99 0.01 **
>> Residual 139 114.644
>> ---
>> Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
>>>
>
>
>
>
> I would like to extract as a table:
>
>> Df Var F N.Perm Pr(>F)
>> mds3dCS_NULL 3 6.527 2.6380 99 0.01 **
>> mds3dTRE_25_2_CS25 3 5.596 2.2616 99 0.01 **
>> mydata$LAT.x 1 1.892 2.2939 99 0.01 **
>> mydata$LONG.x 1 1.891 2.2929 99 0.01 **
>> mydata$Hab_Config 2 2.772 1.6807 99 0.01 **
>> mds3dTRE_25_100_CS25 3 3.952 1.5970 99 0.01 **
>> mydata$TreeCov 1 1.272 1.5418 99 0.01 **
>> mydata$Site_No 1 1.345 1.6306 99 0.01 **
>> mds3dSFW_EO_100_CS25 3 3.741 1.5120 99 0.01 **
>> mds3dSFW_EO_5000_CS25 3 3.410 1.3783 99 0.01 **
>> mydata$Landscape 8 9.300 1.4094 99 0.01 **
>> mds3dSFW_TH_10_CS25 3 3.658 1.4785 99 0.01 **
>> Residual 139 114.644
>
>
> Is this possible? what is the syntax?
>
> I have looked at str(myAnova) but cannot see how to get the table with
variable names included
Nevil,
The output *is* a data frame so that there is not much to extract. There are a
two extra arguments added to the data frame: heading and Random.seed. One way
of getting rid off those is to use command as.data.frame():
as.data.frame(myAnova)
However, you will not get significance stars with this: the stars are not a
part of the result, but they are only displayed when you print the result and if
getOption("show.signif.stars") is TRUE. Moreover, the last line
("Residuals") has some cells which are printed as empty, but they are
not empty: they contain NA and they only look empty because print.anova sets
option na.print = "" in printCoefmat() it uses internally.
Putting these together: if you only want to have the data frame, you have it or
may strip extra arguments using as.data.frame(myAnova). If you want to get
printed output like in your example above, you can use
printCoefmat(as.data.frame(myAnova), na.print="", signif.legend=FALSE)
Cheers, Jari Oksanen
--
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
jari.oksanen at oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa