开发者

How can I change what is printed when I type an object name?

开发者 https://www.devze.com 2023-02-04 11:45 出处:网络
The function ezANOVA in the ez package calcula开发者_StackOverflow中文版tes an ANOVA.Often I want to look at the means inside of these cells.Normally I just retype the formula and use the summaryBy fu

The function ezANOVA in the ez package calcula开发者_StackOverflow中文版tes an ANOVA. Often I want to look at the means inside of these cells. Normally I just retype the formula and use the summaryBy function. This morning I modified the ezANOVA function so that it included in its resulting object the data required to do a summaryBy command. How can I change the object resulting from ezANOVA to by default hide this extra data when printed?


Your question is a little obscure. If you are returning an object with a class you can modify the print or show method for the corresponding class. You will have to know if you are dealing with an S3 or S4 class. loos at ?methods of ?Methods for details. as a quick example if you return an s3 class 'ezANOVA' you define a function.

print.ezANOVA<-function(x){
   #code for formatting the ezANOVA object nice.
}

Update In light of your comment, and that you have already modified the exANOVA function. add this to the end of ezANOVA.

class(return.value)<-"ezANOVA"
return(return.value)

then add the print.ezANOVA function and that should handle it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号