From da8347779c58501c80d96f310e340f6431fc1b75 Mon Sep 17 00:00:00 2001 From: cimentadaj Date: Sun, 10 Jun 2018 13:50:08 +0200 Subject: [PATCH] Implements tidy.Kendall + adds info in DESCRIP, NAMESPACE, etc.. --- DESCRIPTION | 226 ++++++++-------- NAMESPACE | 489 +++++++++++++++++----------------- NEWS.md | 299 ++++++++++----------- R/kendall_tidiers.R | 56 ++++ broom.Rproj | 40 +-- man/tidy.Kendall.Rd | 50 ++++ tests/testthat/test-kendall.R | 16 ++ 7 files changed, 651 insertions(+), 525 deletions(-) create mode 100644 R/kendall_tidiers.R create mode 100644 man/tidy.Kendall.Rd create mode 100644 tests/testthat/test-kendall.R diff --git a/DESCRIPTION b/DESCRIPTION index 217fc7557..3eb70cd9a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,112 +1,114 @@ -Type: Package -Package: broom -Title: Convert Statistical Analysis Objects into Tidy Data Frames -Version: 0.4.4.9000 -Date: 2018-06-04 -Authors@R: c( - person("David", "Robinson", email = "admiral.david@gmail.com", role = c("aut", "cre")), - person("Matthieu", "Gomez", email = "mattg@princeton.edu", role = "ctb"), - person("Boris", "Demeshev", email = "boris.demeshev@gmail.com", role = "ctb"), - person("Dieter", "Menne", email = "dieter.menne@menne-biomed.de", role = "ctb"), - person("Benjamin", "Nutter", email = "nutter@battelle.org", role = "ctb"), - person("Luke", "Johnston", email = "luke.johnston@mail.utoronto.ca", role = "ctb"), - person("Ben", "Bolker", email = "bolker@mcmaster.ca", role = "ctb"), - person("Francois", "Briatte", email = "f.briatte@gmail.com", role = "ctb"), - person("Jeffrey", "Arnold", email = "jeffrey.arnold@gmail.com", role = "ctb"), - person("Jonah", "Gabry", email = "jsg2201@columbia.edu", role = "ctb"), - person("Luciano", "Selzer", email = "luciano.selzer@gmail.com", role = "ctb"), - person("Gavin", "Simpson", email = "ucfagls@gmail.com", role = "ctb"), - person("Jens", "Preussner", email = " jens.preussner@mpi-bn.mpg.de", role = "ctb"), - person("Jay", "Hesselberth", email = "jay.hesselberth@gmail.com", role = "ctb"), - person("Hadley", "Wickham", email = "hadley@rstudio.com", role = "ctb"), - person("Matthew", "Lincoln", email = "matthew.d.lincoln@gmail.com", role = "ctb"), - person("Lukasz", "Komsta", email = "lukasz.komsta@umlub.pl", role = "ctb"), - person("Frederick", "Novometsky", role = "ctb"), - person("Wilson", "Freitas", role = "ctb"), - person("Jason Cory", "Brunson", email = "cornelioid@gmail.com", role = "ctb"), - person("Simon", "Jackson", email = "drsimonjackson@gmail.com", role = "ctb")) -Maintainer: David Robinson -Description: Convert statistical analysis objects from R into tidy data frames, - so that they can more easily be combined, reshaped and otherwise processed - with tools like 'dplyr', 'tidyr' and 'ggplot2'. The package provides three - S3 generics: tidy, which summarizes a model's statistical findings such as - coefficients of a regression; augment, which adds columns to the original - data such as predictions, residuals and cluster assignments; and glance, which - provides a one-row summary of model-level statistics. -License: MIT + file LICENSE -URL: http://github.com/tidyverse/broom -BugReports: http://github.com/tidyverse/broom/issues -Imports: - dplyr, - methods, - nlme, - plyr, - reshape2, - stringr, - tibble, - tidyr -Suggests: - AER, - akima, - AUC, - bbmle, - betareg, - biglm, - binGroup, - boot, - brms, - btergm, - car, - coda, - covr, - emmeans, - ergm, - gam, - gamlss, - geepack, - ggplot2, - glmnet, - gmm, - Hmisc, - irlba, - knitr, - ks, - Lahman, - lfe, - lme4, - lmodel2, - lmtest, - lsmeans, - maps, - maptools, - MASS, - Matrix, - mclust, - mgcv, - muhaz, - multcomp, - network, - nnet, - orcutt, - ordinal, - plm, - poLCA, - psych, - purrr, - rgeos, - rmarkdown, - robust, - rsample, - rstan, - rstanarm, - sp, - speedglm, - statnet.common, - survival, - survey, - testthat, - xergm, - zoo, - tseries -VignetteBuilder: knitr -RoxygenNote: 6.0.1 +Type: Package +Package: broom +Title: Convert Statistical Analysis Objects into Tidy Data Frames +Version: 0.4.4.9000 +Date: 2018-06-04 +Authors@R: c( + person("David", "Robinson", email = "admiral.david@gmail.com", role = c("aut", "cre")), + person("Matthieu", "Gomez", email = "mattg@princeton.edu", role = "ctb"), + person("Boris", "Demeshev", email = "boris.demeshev@gmail.com", role = "ctb"), + person("Dieter", "Menne", email = "dieter.menne@menne-biomed.de", role = "ctb"), + person("Benjamin", "Nutter", email = "nutter@battelle.org", role = "ctb"), + person("Luke", "Johnston", email = "luke.johnston@mail.utoronto.ca", role = "ctb"), + person("Ben", "Bolker", email = "bolker@mcmaster.ca", role = "ctb"), + person("Francois", "Briatte", email = "f.briatte@gmail.com", role = "ctb"), + person("Jeffrey", "Arnold", email = "jeffrey.arnold@gmail.com", role = "ctb"), + person("Jonah", "Gabry", email = "jsg2201@columbia.edu", role = "ctb"), + person("Luciano", "Selzer", email = "luciano.selzer@gmail.com", role = "ctb"), + person("Gavin", "Simpson", email = "ucfagls@gmail.com", role = "ctb"), + person("Jens", "Preussner", email = " jens.preussner@mpi-bn.mpg.de", role = "ctb"), + person("Jay", "Hesselberth", email = "jay.hesselberth@gmail.com", role = "ctb"), + person("Hadley", "Wickham", email = "hadley@rstudio.com", role = "ctb"), + person("Matthew", "Lincoln", email = "matthew.d.lincoln@gmail.com", role = "ctb"), + person("Lukasz", "Komsta", email = "lukasz.komsta@umlub.pl", role = "ctb"), + person("Frederick", "Novometsky", role = "ctb"), + person("Wilson", "Freitas", role = "ctb"), + person("Jason Cory", "Brunson", email = "cornelioid@gmail.com", role = "ctb"), + person("Simon", "Jackson", email = "drsimonjackson@gmail.com", role = "ctb"), + person("Jorge", "Cimentada", email = "cimentadaj@gmail.com", role = "ctb")) +Maintainer: David Robinson +Description: Convert statistical analysis objects from R into tidy data frames, + so that they can more easily be combined, reshaped and otherwise processed + with tools like 'dplyr', 'tidyr' and 'ggplot2'. The package provides three + S3 generics: tidy, which summarizes a model's statistical findings such as + coefficients of a regression; augment, which adds columns to the original + data such as predictions, residuals and cluster assignments; and glance, which + provides a one-row summary of model-level statistics. +License: MIT + file LICENSE +URL: http://github.com/tidyverse/broom +BugReports: http://github.com/tidyverse/broom/issues +Imports: + dplyr, + methods, + nlme, + plyr, + reshape2, + stringr, + tibble, + tidyr +Suggests: + AER, + akima, + AUC, + bbmle, + betareg, + biglm, + binGroup, + boot, + brms, + btergm, + car, + coda, + covr, + emmeans, + ergm, + gam, + gamlss, + geepack, + ggplot2, + glmnet, + gmm, + Hmisc, + irlba, + knitr, + ks, + Lahman, + lfe, + lme4, + lmodel2, + lmtest, + lsmeans, + maps, + maptools, + MASS, + Matrix, + mclust, + mgcv, + muhaz, + multcomp, + network, + nnet, + orcutt, + ordinal, + plm, + poLCA, + psych, + purrr, + rgeos, + rmarkdown, + robust, + rsample, + rstan, + rstanarm, + sp, + speedglm, + statnet.common, + survival, + survey, + testthat, + xergm, + zoo, + tseries, + Kendall +VignetteBuilder: knitr +RoxygenNote: 6.0.1 diff --git a/NAMESPACE b/NAMESPACE index 59bf2adc6..6f50970d3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,244 +1,245 @@ -# Generated by roxygen2: do not edit by hand - -S3method(augment,"NULL") -S3method(augment,Mclust) -S3method(augment,betareg) -S3method(augment,clm) -S3method(augment,coxph) -S3method(augment,data.frame) -S3method(augment,decomposed.ts) -S3method(augment,default) -S3method(augment,factanal) -S3method(augment,felm) -S3method(augment,garch) -S3method(augment,glmRob) -S3method(augment,htest) -S3method(augment,ivreg) -S3method(augment,kmeans) -S3method(augment,lm) -S3method(augment,lmRob) -S3method(augment,lme) -S3method(augment,loess) -S3method(augment,merMod) -S3method(augment,mlm) -S3method(augment,nlrq) -S3method(augment,nls) -S3method(augment,plm) -S3method(augment,poLCA) -S3method(augment,polr) -S3method(augment,prcomp) -S3method(augment,rowwise_df) -S3method(augment,rq) -S3method(augment,rqs) -S3method(augment,smooth.spline) -S3method(augment,speedlm) -S3method(augment,stl) -S3method(augment,survreg) -S3method(augment,tbl_df) -S3method(augment_,rowwise_df) -S3method(glance,"NULL") -S3method(glance,Arima) -S3method(glance,Gam) -S3method(glance,Mclust) -S3method(glance,aareg) -S3method(glance,betareg) -S3method(glance,biglm) -S3method(glance,binDesign) -S3method(glance,cch) -S3method(glance,clm) -S3method(glance,clmm) -S3method(glance,coxph) -S3method(glance,cv.glmnet) -S3method(glance,data.frame) -S3method(glance,default) -S3method(glance,durbinWatsonTest) -S3method(glance,ergm) -S3method(glance,factanal) -S3method(glance,felm) -S3method(glance,fitdistr) -S3method(glance,gam) -S3method(glance,garch) -S3method(glance,glm) -S3method(glance,glmRob) -S3method(glance,glmnet) -S3method(glance,gmm) -S3method(glance,htest) -S3method(glance,ivreg) -S3method(glance,kmeans) -S3method(glance,list) -S3method(glance,lm) -S3method(glance,lmRob) -S3method(glance,lme) -S3method(glance,lmodel2) -S3method(glance,matrix) -S3method(glance,merMod) -S3method(glance,mlm) -S3method(glance,muhaz) -S3method(glance,multinom) -S3method(glance,nlrq) -S3method(glance,nls) -S3method(glance,orcutt) -S3method(glance,plm) -S3method(glance,poLCA) -S3method(glance,polr) -S3method(glance,pyears) -S3method(glance,ridgelm) -S3method(glance,rlm) -S3method(glance,rowwise_df) -S3method(glance,rq) -S3method(glance,rqs) -S3method(glance,smooth.spline) -S3method(glance,speedlm) -S3method(glance,stanreg) -S3method(glance,summary.lm) -S3method(glance,summaryDefault) -S3method(glance,survdiff) -S3method(glance,survexp) -S3method(glance,survfit) -S3method(glance,survreg) -S3method(glance,svyolr) -S3method(glance,tbl_df) -S3method(glance_,rowwise_df) -S3method(tidy,"NULL") -S3method(tidy,Arima) -S3method(tidy,Gam) -S3method(tidy,Line) -S3method(tidy,Lines) -S3method(tidy,Mclust) -S3method(tidy,Polygon) -S3method(tidy,Polygons) -S3method(tidy,SpatialLinesDataFrame) -S3method(tidy,SpatialPolygons) -S3method(tidy,SpatialPolygonsDataFrame) -S3method(tidy,TukeyHSD) -S3method(tidy,aareg) -S3method(tidy,acf) -S3method(tidy,anova) -S3method(tidy,aov) -S3method(tidy,aovlist) -S3method(tidy,betareg) -S3method(tidy,biglm) -S3method(tidy,binDesign) -S3method(tidy,binWidth) -S3method(tidy,boot) -S3method(tidy,brmsfit) -S3method(tidy,btergm) -S3method(tidy,cch) -S3method(tidy,character) -S3method(tidy,cld) -S3method(tidy,clm) -S3method(tidy,clmm) -S3method(tidy,coeftest) -S3method(tidy,confint.glht) -S3method(tidy,coxph) -S3method(tidy,cv.glmnet) -S3method(tidy,data.frame) -S3method(tidy,default) -S3method(tidy,density) -S3method(tidy,dgCMatrix) -S3method(tidy,dgTMatrix) -S3method(tidy,dist) -S3method(tidy,durbinWatsonTest) -S3method(tidy,emmGrid) -S3method(tidy,ergm) -S3method(tidy,factanal) -S3method(tidy,felm) -S3method(tidy,fitdistr) -S3method(tidy,ftable) -S3method(tidy,gam) -S3method(tidy,gamlss) -S3method(tidy,garch) -S3method(tidy,geeglm) -S3method(tidy,glht) -S3method(tidy,glmRob) -S3method(tidy,glmnet) -S3method(tidy,gmm) -S3method(tidy,htest) -S3method(tidy,ivreg) -S3method(tidy,kappa) -S3method(tidy,kde) -S3method(tidy,kmeans) -S3method(tidy,list) -S3method(tidy,lm) -S3method(tidy,lmRob) -S3method(tidy,lme) -S3method(tidy,lmodel2) -S3method(tidy,logical) -S3method(tidy,lsmobj) -S3method(tidy,manova) -S3method(tidy,map) -S3method(tidy,matrix) -S3method(tidy,merMod) -S3method(tidy,mle2) -S3method(tidy,muhaz) -S3method(tidy,multinom) -S3method(tidy,nlrq) -S3method(tidy,nls) -S3method(tidy,numeric) -S3method(tidy,orcutt) -S3method(tidy,pairwise.htest) -S3method(tidy,plm) -S3method(tidy,poLCA) -S3method(tidy,polr) -S3method(tidy,power.htest) -S3method(tidy,prcomp) -S3method(tidy,pyears) -S3method(tidy,rcorr) -S3method(tidy,ref.grid) -S3method(tidy,ridgelm) -S3method(tidy,rjags) -S3method(tidy,roc) -S3method(tidy,rowwise_df) -S3method(tidy,rq) -S3method(tidy,rqs) -S3method(tidy,sparseMatrix) -S3method(tidy,spec) -S3method(tidy,speedlm) -S3method(tidy,stanfit) -S3method(tidy,stanreg) -S3method(tidy,summary.glht) -S3method(tidy,summary.lm) -S3method(tidy,summaryDefault) -S3method(tidy,survdiff) -S3method(tidy,survexp) -S3method(tidy,survfit) -S3method(tidy,survreg) -S3method(tidy,svyolr) -S3method(tidy,table) -S3method(tidy,tbl_df) -S3method(tidy,ts) -S3method(tidy,zoo) -S3method(tidy_,rowwise_df) -export(augment) -export(augment_columns) -export(bootstrap) -export(confint_tidy) -export(finish_glance) -export(fix_data_frame) -export(glance) -export(inflate) -export(tidy) -export(tidyMCMC) -import(dplyr) -import(tidyr) -importFrom(nlme,VarCorr) -importFrom(nlme,ranef) -importFrom(plyr,ldply) -importFrom(plyr,rbind.fill) -importFrom(reshape2,melt) -importFrom(stats,AIC) -importFrom(stats,coef) -importFrom(stats,confint) -importFrom(stats,fitted) -importFrom(stats,logLik) -importFrom(stats,model.frame) -importFrom(stats,na.omit) -importFrom(stats,predict) -importFrom(stats,qnorm) -importFrom(stats,qt) -importFrom(stats,residuals) -importFrom(stats,setNames) -importFrom(stats,var) -importFrom(tidyr,gather) -importFrom(tidyr,spread) -importFrom(utils,head) +# Generated by roxygen2: do not edit by hand + +S3method(augment,"NULL") +S3method(augment,Mclust) +S3method(augment,betareg) +S3method(augment,clm) +S3method(augment,coxph) +S3method(augment,data.frame) +S3method(augment,decomposed.ts) +S3method(augment,default) +S3method(augment,factanal) +S3method(augment,felm) +S3method(augment,garch) +S3method(augment,glmRob) +S3method(augment,htest) +S3method(augment,ivreg) +S3method(augment,kmeans) +S3method(augment,lm) +S3method(augment,lmRob) +S3method(augment,lme) +S3method(augment,loess) +S3method(augment,merMod) +S3method(augment,mlm) +S3method(augment,nlrq) +S3method(augment,nls) +S3method(augment,plm) +S3method(augment,poLCA) +S3method(augment,polr) +S3method(augment,prcomp) +S3method(augment,rowwise_df) +S3method(augment,rq) +S3method(augment,rqs) +S3method(augment,smooth.spline) +S3method(augment,speedlm) +S3method(augment,stl) +S3method(augment,survreg) +S3method(augment,tbl_df) +S3method(augment_,rowwise_df) +S3method(glance,"NULL") +S3method(glance,Arima) +S3method(glance,Gam) +S3method(glance,Mclust) +S3method(glance,aareg) +S3method(glance,betareg) +S3method(glance,biglm) +S3method(glance,binDesign) +S3method(glance,cch) +S3method(glance,clm) +S3method(glance,clmm) +S3method(glance,coxph) +S3method(glance,cv.glmnet) +S3method(glance,data.frame) +S3method(glance,default) +S3method(glance,durbinWatsonTest) +S3method(glance,ergm) +S3method(glance,factanal) +S3method(glance,felm) +S3method(glance,fitdistr) +S3method(glance,gam) +S3method(glance,garch) +S3method(glance,glm) +S3method(glance,glmRob) +S3method(glance,glmnet) +S3method(glance,gmm) +S3method(glance,htest) +S3method(glance,ivreg) +S3method(glance,kmeans) +S3method(glance,list) +S3method(glance,lm) +S3method(glance,lmRob) +S3method(glance,lme) +S3method(glance,lmodel2) +S3method(glance,matrix) +S3method(glance,merMod) +S3method(glance,mlm) +S3method(glance,muhaz) +S3method(glance,multinom) +S3method(glance,nlrq) +S3method(glance,nls) +S3method(glance,orcutt) +S3method(glance,plm) +S3method(glance,poLCA) +S3method(glance,polr) +S3method(glance,pyears) +S3method(glance,ridgelm) +S3method(glance,rlm) +S3method(glance,rowwise_df) +S3method(glance,rq) +S3method(glance,rqs) +S3method(glance,smooth.spline) +S3method(glance,speedlm) +S3method(glance,stanreg) +S3method(glance,summary.lm) +S3method(glance,summaryDefault) +S3method(glance,survdiff) +S3method(glance,survexp) +S3method(glance,survfit) +S3method(glance,survreg) +S3method(glance,svyolr) +S3method(glance,tbl_df) +S3method(glance_,rowwise_df) +S3method(tidy,"NULL") +S3method(tidy,Arima) +S3method(tidy,Gam) +S3method(tidy,Kendall) +S3method(tidy,Line) +S3method(tidy,Lines) +S3method(tidy,Mclust) +S3method(tidy,Polygon) +S3method(tidy,Polygons) +S3method(tidy,SpatialLinesDataFrame) +S3method(tidy,SpatialPolygons) +S3method(tidy,SpatialPolygonsDataFrame) +S3method(tidy,TukeyHSD) +S3method(tidy,aareg) +S3method(tidy,acf) +S3method(tidy,anova) +S3method(tidy,aov) +S3method(tidy,aovlist) +S3method(tidy,betareg) +S3method(tidy,biglm) +S3method(tidy,binDesign) +S3method(tidy,binWidth) +S3method(tidy,boot) +S3method(tidy,brmsfit) +S3method(tidy,btergm) +S3method(tidy,cch) +S3method(tidy,character) +S3method(tidy,cld) +S3method(tidy,clm) +S3method(tidy,clmm) +S3method(tidy,coeftest) +S3method(tidy,confint.glht) +S3method(tidy,coxph) +S3method(tidy,cv.glmnet) +S3method(tidy,data.frame) +S3method(tidy,default) +S3method(tidy,density) +S3method(tidy,dgCMatrix) +S3method(tidy,dgTMatrix) +S3method(tidy,dist) +S3method(tidy,durbinWatsonTest) +S3method(tidy,emmGrid) +S3method(tidy,ergm) +S3method(tidy,factanal) +S3method(tidy,felm) +S3method(tidy,fitdistr) +S3method(tidy,ftable) +S3method(tidy,gam) +S3method(tidy,gamlss) +S3method(tidy,garch) +S3method(tidy,geeglm) +S3method(tidy,glht) +S3method(tidy,glmRob) +S3method(tidy,glmnet) +S3method(tidy,gmm) +S3method(tidy,htest) +S3method(tidy,ivreg) +S3method(tidy,kappa) +S3method(tidy,kde) +S3method(tidy,kmeans) +S3method(tidy,list) +S3method(tidy,lm) +S3method(tidy,lmRob) +S3method(tidy,lme) +S3method(tidy,lmodel2) +S3method(tidy,logical) +S3method(tidy,lsmobj) +S3method(tidy,manova) +S3method(tidy,map) +S3method(tidy,matrix) +S3method(tidy,merMod) +S3method(tidy,mle2) +S3method(tidy,muhaz) +S3method(tidy,multinom) +S3method(tidy,nlrq) +S3method(tidy,nls) +S3method(tidy,numeric) +S3method(tidy,orcutt) +S3method(tidy,pairwise.htest) +S3method(tidy,plm) +S3method(tidy,poLCA) +S3method(tidy,polr) +S3method(tidy,power.htest) +S3method(tidy,prcomp) +S3method(tidy,pyears) +S3method(tidy,rcorr) +S3method(tidy,ref.grid) +S3method(tidy,ridgelm) +S3method(tidy,rjags) +S3method(tidy,roc) +S3method(tidy,rowwise_df) +S3method(tidy,rq) +S3method(tidy,rqs) +S3method(tidy,sparseMatrix) +S3method(tidy,spec) +S3method(tidy,speedlm) +S3method(tidy,stanfit) +S3method(tidy,stanreg) +S3method(tidy,summary.glht) +S3method(tidy,summary.lm) +S3method(tidy,summaryDefault) +S3method(tidy,survdiff) +S3method(tidy,survexp) +S3method(tidy,survfit) +S3method(tidy,survreg) +S3method(tidy,svyolr) +S3method(tidy,table) +S3method(tidy,tbl_df) +S3method(tidy,ts) +S3method(tidy,zoo) +S3method(tidy_,rowwise_df) +export(augment) +export(augment_columns) +export(bootstrap) +export(confint_tidy) +export(finish_glance) +export(fix_data_frame) +export(glance) +export(inflate) +export(tidy) +export(tidyMCMC) +import(dplyr) +import(tidyr) +importFrom(nlme,VarCorr) +importFrom(nlme,ranef) +importFrom(plyr,ldply) +importFrom(plyr,rbind.fill) +importFrom(reshape2,melt) +importFrom(stats,AIC) +importFrom(stats,coef) +importFrom(stats,confint) +importFrom(stats,fitted) +importFrom(stats,logLik) +importFrom(stats,model.frame) +importFrom(stats,na.omit) +importFrom(stats,predict) +importFrom(stats,qnorm) +importFrom(stats,qt) +importFrom(stats,residuals) +importFrom(stats,setNames) +importFrom(stats,var) +importFrom(tidyr,gather) +importFrom(tidyr,spread) +importFrom(utils,head) diff --git a/NEWS.md b/NEWS.md index 2f2ab4af7..7f7626763 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,149 +1,150 @@ -broom 0.4.4.9000 ------------ - -* `bootstrap()` and data frame tidiers have been deprecated -* New vignettes on the available tidying methods, contributing new tidiers -* Updated old vignettes to use `map/unnest` workflow rather than `rowwise/do` -* Bump version number -* Added `augment` method for chi-squared tests -* Added tieders for ordinal models: `clm` and `clmm` (ordinal), `polr` (MASS), `svyolr` (survey) - -broom 0.4.4 ------------ - -* Fixed gam tidiers to work with "Gam" objects, due to an update in gam 1.15. This fixes failing CRAN tests -* Improved test coverage (thanks to #267 from Derek Chiu) - -broom 0.4.3 ------------ - -* Changed the deprecated `dplyr::failwith` to `purrr::possibly` -* `augment` and `glance` on NULLs now return an empty data frame -* Deprecated the `inflate()` function in favor of `tidyr::crossing` -* Fixed confidence intervals in the gmm tidier (thanks to #242 from David Hugh-Jones) -* Fixed a bug in bootstrap tidiers (thanks to #167 from Jeremy Biesanz) -* Fixed tidy.lm with `quick = TRUE` to return terms as character rather than factor (thanks to #191 from Matteo Sostero) -* Added tidiers for `ivreg` objects from the AER package (thanks to #245 from David Hugh-Jones) -* Added tidiers for `survdiff` objects from the survival package (thanks to #147 from Michał Bojanowski) -* Added tidiers for `emmeans` from the emmeans package (thanks to #252 from Matthew Kay) -* Added tidiers for `speedlm` and `speedglm` from the speedglm package (thanks to #248 from David Hugh-Jones) -* Added tidiers for `muhaz` objects from the muhaz package (thanks to #251 from Andreas Bender) -* Added tidiers for `decompose` and `stl` objects from stats (thanks to #165 from Aaron Jacobs) - -broom 0.4.2 ------------ - -* Added tidiers for `lsmobj` and `ref.grid` objects from the lsmeans package -* Added tidiers for `betareg` objects from the betareg package -* Added tidiers for `lmRob` and `glmRob` objects from the robust package -* Added tidiers for `brms` objects from the brms package (thanks to #149 from Paul Buerkner) -* Fixed tidiers for orcutt 2.0 -* Changed `tidy.glmnet` to filter out rows where estimate == 0. -* Updates to `rstanarm` tidiers (thanks to #177 from Jonah Gabry) -* Fixed issue with survival package 2.40-1 (thanks to #180 from Marcus Walz) - -broom 0.4.1 ------------ - -* Added AppVeyor, codecov.io, and code of conduct -* Changed name of "NA's" column in summaryDefault output to "na" -* Fixed `tidy.TukeyHSD` to include `term` column. Also added `separate.levels` argument, with option to separate `comparison` into `level1` and `level2` -* Fixed `tidy.manova` to use correct column name for test (previously, always `pillai`) -* Added `kde_tidiers` to tidy kernel density estimates -* Added `orcutt_tidiers` to tidy the results of `cochrane.orcutt` orcutt package -* Added `tidy.dist` to tidy the distance matrix output of `dist` from the stats package -* Added `tidy` and `glance` for `lmodel2` objects from the lmodel2 package -* Added tidiers for `poLCA` objects from the poLCA package -* Added tidiers for sparse matrices from the Matrix package -* Added tidiers for `prcomp` objects -* Added tidiers for `Mclust` objects from the Mclust package -* Added tidiers for `acf` objects -* Fixed to be compatible with dplyr 0.5, which is being submitted to CRAN - -broom 0.4.0 ------------ - -* Added tidiers for geeglm, nlrq, roc, boot, bgterm, kappa, binWidth, binDesign, rcorr, stanfit, rjags, gamlss, and mle2 objects. -* Added `tidy` methods for lists, including u, d, v lists from `svd`, and x, y, z lists used by `image` and `persp` -* Added `quick` argument to `tidy.lm`, `tidy.nls`, and `tidy.biglm`, to create a smaller and faster version of the output. -* Changed `rowwise_df_tidiers` to allow the original data to be saved as a list column, then provided as a column name to `augment`. This required removing `data` from the `augment` S3 signature. Also added `tests-rowwise.R` -* Fixed various issues in ANOVA output -* Fixed various issues in lme4 output -* Fixed issues in tests caused by dev version of ggplot2 - -broom 0.3.7 ------------ - -* Added tidiers for "plm" (panel linear model) objects from the plm package. -* Added `tidy.coeftest` for coeftest objects from the lmtest package. -* Set up `tidy.lm` to work with "mlm" (multiple linear model) objects (those with multiple response columns). -* Added `tidy` and `glance` for "biglm" and "bigglm" objects from the biglm package. -* Fixed bug in `tidy.coxph` when one-row matrices are returned -* Added `tidy.power.htest` -* Added `tidy` and `glance` for `summaryDefault` objects -* Added tidiers for "lme" (linear mixed effects models) from the nlme package -* Added `tidy` and `glance` for `multinom` objects from the nnet package. - -broom 0.3.6 ------------ - -* Fixed bug in `tidy.pairwise.htest`, which now can handle cases where the grouping variable is numeric. -* Added `tidy.aovlist` method. This added `stringr` package to IMPORTS to trim whitespace from the beginning and end of the `term` and `stratum` columns. This also required adjusting `tidy.aov` so that it could handle strata that are missing p-values. -* Set up `glance.lm` to work with `aov` objects along with `lm` objects. -* Added `tidy` and `glance` for matrix objects, with `tidy.matrix` converting a matrix to a data frame with rownames included, and `glance.matrix` returning the same result as `glance.data.frame`. -* Changed DESCRIPTION Authors@R to new format - -broom 0.3.5 ------------ - -* Fixed small bug in `felm` where the `.fitted` and `.resid` columns were matrices rather than vectors. -* Added tidiers for `rlm` (robust linear model) and `gam` (generalized additive model) objects, including adjustments to "lm" tidiers in order to handle them. See `?rlm_tidiers` and `?gam_tidiers` for more. -* Removed rownames from `tidy.cv.glmnet` output - -broom 0.3.4 ------------ - -* The behavior of `augment`, particularly with regard to missing data and the `na.exclude` argument, has through the use of the `augment_columns` function been made consistent across the following models: - * `lm` - * `glm` - * `nls` - * `merMod` (`lme4`) - * `survreg` (`survival`) - * `coxph` (`survival`) - - Unit tests in `tests/testthat/test-augment.R` were added to ensure consistency across these models. -* `tidy`, `augment` and `glance` methods were added for `rowwise_df` objects, and are set up to apply across their rows. This allows for simple patterns such as: - - regressions <- mtcars %>% group_by(cyl) %>% do(mod = lm(mpg ~ wt, .)) - regressions %>% tidy(mod) - regressions %>% augment(mod) - - See `?rowwise_df_tidiers` for more. -* Added `tidy` and `glance` methods for `Arima` objects, and `tidy` for `pairwise.htest` objects. -* Fixes for CRAN: change package description to title case, removed NOTES, mostly by adding `globals.R` to declare global variables. -* This is the original version published on CRAN. - - -broom 0.3 ---------- - -* Tidiers have been added for S3 objects from the following packages: - * `lme4` - * `glmnet` - * `survival` - * `zoo` - * `felm` - * `MASS` (`ridgelm` objects) -* `tidy` and `glance` methods for data.frames have also been added, and `augment.data.frame` produces an error (rather than returning the same data.frame). -* `stderror` has been changed to `std.error` (affects many functions) to be consistent with broom's naming conventions for columns. -* A function `bootstrap` has been added based on [this example](https://github.com/hadley/dplyr/issues/269), to perform the common use case of bootstrapping models. - -broom 0.2 ---------- - -* Added "augment" S3 generic and various implementations. "augment" does something different from tidy: it adds columns to the original dataset, including predictions, residuals, or cluster assignments. This was originally described as "fortify" in ggplot2. -* Added "glance" S3 generic and various implementations. "glance" produces a *one-row* data frame summary, which is necessary for tidy outputs with values like R^2 or F-statistics. -* Re-wrote intro broom vignette/README to introduce all three methods. -* Wrote a new kmeans vignette. -* Added tidying methods for multcomp, sp, and map objects (from fortify-multcomp, fortify-sp, and fortify-map from ggplot2). -* Because this integrates substantial amounts of ggplot2 code (with permission), added Hadley Wickham as an author in DESCRIPTION. +broom 0.4.4.9000 +----------- + +* `bootstrap()` and data frame tidiers have been deprecated +* New vignettes on the available tidying methods, contributing new tidiers +* Updated old vignettes to use `map/unnest` workflow rather than `rowwise/do` +* Bump version number +* Added `augment` method for chi-squared tests +* Added tidiers for ordinal models: `clm` and `clmm` (ordinal), `polr` (MASS), `svyolr` (survey) +* Added tidiers for `Kendall`, `MannKendall` and `SeasonalMannKendall` from the Kendall package (thanks to #285 from Jorge Cimentada)s + +broom 0.4.4 +----------- + +* Fixed gam tidiers to work with "Gam" objects, due to an update in gam 1.15. This fixes failing CRAN tests +* Improved test coverage (thanks to #267 from Derek Chiu) + +broom 0.4.3 +----------- + +* Changed the deprecated `dplyr::failwith` to `purrr::possibly` +* `augment` and `glance` on NULLs now return an empty data frame +* Deprecated the `inflate()` function in favor of `tidyr::crossing` +* Fixed confidence intervals in the gmm tidier (thanks to #242 from David Hugh-Jones) +* Fixed a bug in bootstrap tidiers (thanks to #167 from Jeremy Biesanz) +* Fixed tidy.lm with `quick = TRUE` to return terms as character rather than factor (thanks to #191 from Matteo Sostero) +* Added tidiers for `ivreg` objects from the AER package (thanks to #245 from David Hugh-Jones) +* Added tidiers for `survdiff` objects from the survival package (thanks to #147 from Michał Bojanowski) +* Added tidiers for `emmeans` from the emmeans package (thanks to #252 from Matthew Kay) +* Added tidiers for `speedlm` and `speedglm` from the speedglm package (thanks to #248 from David Hugh-Jones) +* Added tidiers for `muhaz` objects from the muhaz package (thanks to #251 from Andreas Bender) +* Added tidiers for `decompose` and `stl` objects from stats (thanks to #165 from Aaron Jacobs) + +broom 0.4.2 +----------- + +* Added tidiers for `lsmobj` and `ref.grid` objects from the lsmeans package +* Added tidiers for `betareg` objects from the betareg package +* Added tidiers for `lmRob` and `glmRob` objects from the robust package +* Added tidiers for `brms` objects from the brms package (thanks to #149 from Paul Buerkner) +* Fixed tidiers for orcutt 2.0 +* Changed `tidy.glmnet` to filter out rows where estimate == 0. +* Updates to `rstanarm` tidiers (thanks to #177 from Jonah Gabry) +* Fixed issue with survival package 2.40-1 (thanks to #180 from Marcus Walz) + +broom 0.4.1 +----------- + +* Added AppVeyor, codecov.io, and code of conduct +* Changed name of "NA's" column in summaryDefault output to "na" +* Fixed `tidy.TukeyHSD` to include `term` column. Also added `separate.levels` argument, with option to separate `comparison` into `level1` and `level2` +* Fixed `tidy.manova` to use correct column name for test (previously, always `pillai`) +* Added `kde_tidiers` to tidy kernel density estimates +* Added `orcutt_tidiers` to tidy the results of `cochrane.orcutt` orcutt package +* Added `tidy.dist` to tidy the distance matrix output of `dist` from the stats package +* Added `tidy` and `glance` for `lmodel2` objects from the lmodel2 package +* Added tidiers for `poLCA` objects from the poLCA package +* Added tidiers for sparse matrices from the Matrix package +* Added tidiers for `prcomp` objects +* Added tidiers for `Mclust` objects from the Mclust package +* Added tidiers for `acf` objects +* Fixed to be compatible with dplyr 0.5, which is being submitted to CRAN + +broom 0.4.0 +----------- + +* Added tidiers for geeglm, nlrq, roc, boot, bgterm, kappa, binWidth, binDesign, rcorr, stanfit, rjags, gamlss, and mle2 objects. +* Added `tidy` methods for lists, including u, d, v lists from `svd`, and x, y, z lists used by `image` and `persp` +* Added `quick` argument to `tidy.lm`, `tidy.nls`, and `tidy.biglm`, to create a smaller and faster version of the output. +* Changed `rowwise_df_tidiers` to allow the original data to be saved as a list column, then provided as a column name to `augment`. This required removing `data` from the `augment` S3 signature. Also added `tests-rowwise.R` +* Fixed various issues in ANOVA output +* Fixed various issues in lme4 output +* Fixed issues in tests caused by dev version of ggplot2 + +broom 0.3.7 +----------- + +* Added tidiers for "plm" (panel linear model) objects from the plm package. +* Added `tidy.coeftest` for coeftest objects from the lmtest package. +* Set up `tidy.lm` to work with "mlm" (multiple linear model) objects (those with multiple response columns). +* Added `tidy` and `glance` for "biglm" and "bigglm" objects from the biglm package. +* Fixed bug in `tidy.coxph` when one-row matrices are returned +* Added `tidy.power.htest` +* Added `tidy` and `glance` for `summaryDefault` objects +* Added tidiers for "lme" (linear mixed effects models) from the nlme package +* Added `tidy` and `glance` for `multinom` objects from the nnet package. + +broom 0.3.6 +----------- + +* Fixed bug in `tidy.pairwise.htest`, which now can handle cases where the grouping variable is numeric. +* Added `tidy.aovlist` method. This added `stringr` package to IMPORTS to trim whitespace from the beginning and end of the `term` and `stratum` columns. This also required adjusting `tidy.aov` so that it could handle strata that are missing p-values. +* Set up `glance.lm` to work with `aov` objects along with `lm` objects. +* Added `tidy` and `glance` for matrix objects, with `tidy.matrix` converting a matrix to a data frame with rownames included, and `glance.matrix` returning the same result as `glance.data.frame`. +* Changed DESCRIPTION Authors@R to new format + +broom 0.3.5 +----------- + +* Fixed small bug in `felm` where the `.fitted` and `.resid` columns were matrices rather than vectors. +* Added tidiers for `rlm` (robust linear model) and `gam` (generalized additive model) objects, including adjustments to "lm" tidiers in order to handle them. See `?rlm_tidiers` and `?gam_tidiers` for more. +* Removed rownames from `tidy.cv.glmnet` output + +broom 0.3.4 +----------- + +* The behavior of `augment`, particularly with regard to missing data and the `na.exclude` argument, has through the use of the `augment_columns` function been made consistent across the following models: + * `lm` + * `glm` + * `nls` + * `merMod` (`lme4`) + * `survreg` (`survival`) + * `coxph` (`survival`) + + Unit tests in `tests/testthat/test-augment.R` were added to ensure consistency across these models. +* `tidy`, `augment` and `glance` methods were added for `rowwise_df` objects, and are set up to apply across their rows. This allows for simple patterns such as: + + regressions <- mtcars %>% group_by(cyl) %>% do(mod = lm(mpg ~ wt, .)) + regressions %>% tidy(mod) + regressions %>% augment(mod) + + See `?rowwise_df_tidiers` for more. +* Added `tidy` and `glance` methods for `Arima` objects, and `tidy` for `pairwise.htest` objects. +* Fixes for CRAN: change package description to title case, removed NOTES, mostly by adding `globals.R` to declare global variables. +* This is the original version published on CRAN. + + +broom 0.3 +--------- + +* Tidiers have been added for S3 objects from the following packages: + * `lme4` + * `glmnet` + * `survival` + * `zoo` + * `felm` + * `MASS` (`ridgelm` objects) +* `tidy` and `glance` methods for data.frames have also been added, and `augment.data.frame` produces an error (rather than returning the same data.frame). +* `stderror` has been changed to `std.error` (affects many functions) to be consistent with broom's naming conventions for columns. +* A function `bootstrap` has been added based on [this example](https://github.com/hadley/dplyr/issues/269), to perform the common use case of bootstrapping models. + +broom 0.2 +--------- + +* Added "augment" S3 generic and various implementations. "augment" does something different from tidy: it adds columns to the original dataset, including predictions, residuals, or cluster assignments. This was originally described as "fortify" in ggplot2. +* Added "glance" S3 generic and various implementations. "glance" produces a *one-row* data frame summary, which is necessary for tidy outputs with values like R^2 or F-statistics. +* Re-wrote intro broom vignette/README to introduce all three methods. +* Wrote a new kmeans vignette. +* Added tidying methods for multcomp, sp, and map objects (from fortify-multcomp, fortify-sp, and fortify-map from ggplot2). +* Because this integrates substantial amounts of ggplot2 code (with permission), added Hadley Wickham as an author in DESCRIPTION. diff --git a/R/kendall_tidiers.R b/R/kendall_tidiers.R new file mode 100644 index 000000000..673fd5928 --- /dev/null +++ b/R/kendall_tidiers.R @@ -0,0 +1,56 @@ +#' Tidying methods for Kendall objects +#' +#' Tidies the result of an Kendall rank correlation. Works on all functions from the Kendall package. +#' Only a \code{tidy()} method is provided, not an \code{augment()} or \code{glance()} method. +#' +#' @param x Fitted object from the Kendall package. +#' +#' @return \code{tidy()} returns a \code{\link[tibble]{tibble}} with one row and columns: +#' +#' \item{statistic}{Kendall's tau statistic.} +#' \item{p.value}{two-sided p-value.} +#' \item{kendall_score}{Kendall score.} +#' \item{denominator}{The denominator, which is tau=kendall_score/denominator.} +#' \item{var_kendall_score}{Variance of the kendall_score.} +#' +#' @seealso \code{\link[Kendall]{Kendall}} for details on the meaning of each column and implementation. +#' +#' @export +#' +#' @examples +#' +#' \dontrun{ +#' library(Kendall) +#' +#' ### For Kendall #### +#' A <- c(2.5,2.5,2.5,2.5,5,6.5,6.5,10,10,10,10,10,14,14,14,16,17) +#' B <- c(1,1,1,1,2,1,1,2,1,1,1,1,1,1,2,2,2) +#' f_res <- Kendall(A,B) +#' +#' tidy(f_res) +#' +#' ### For MannKendall #### +#' s_res <- MannKendall(B) +#' +#' tidy(s_res) +#' +#' ### For SeasonalMannKendall #### +#' t_res <- SeasonalMannKendall(ts(A)) +#' +#' tidy(t_res) +#' } +tidy.Kendall <- function(x) { + kendall_tidier(x) +} + + +kendall_tidier <- function(x) { + col_names <- c("statistic", + "p.value", + "kendall_score", + "denominator", + "var_kendall_score") + semi_done <- tibble::as_tibble(unclass(x)) + final <- purrr::set_names(semi_done, col_names) + final +} diff --git a/broom.Rproj b/broom.Rproj index ff46899b1..a5cf26ff1 100644 --- a/broom.Rproj +++ b/broom.Rproj @@ -1,20 +1,20 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageRoxygenize: rd,collate,namespace diff --git a/man/tidy.Kendall.Rd b/man/tidy.Kendall.Rd new file mode 100644 index 000000000..30ca6dba7 --- /dev/null +++ b/man/tidy.Kendall.Rd @@ -0,0 +1,50 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/kendall_tidiers.R +\name{tidy.Kendall} +\alias{tidy.Kendall} +\title{Tidying methods for Kendall objects} +\usage{ +\method{tidy}{Kendall}(x) +} +\arguments{ +\item{x}{Fitted object from the Kendall package.} +} +\value{ +\code{tidy()} returns a \code{\link[tibble]{tibble}} with one row and columns: + +\item{statistic}{Kendall's tau statistic.} +\item{p.value}{two-sided p-value.} +\item{kendall_score}{Kendall score.} +\item{denominator}{The denominator, which is tau=kendall_score/denominator.} +\item{var_kendall_score}{Variance of the kendall_score.} +} +\description{ +Tidies the result of an Kendall rank correlation. Works on all functions from the Kendall package. +Only a \code{tidy()} method is provided, not an \code{augment()} or \code{glance()} method. +} +\examples{ + +\dontrun{ +library(Kendall) + +### For Kendall #### +A <- c(2.5,2.5,2.5,2.5,5,6.5,6.5,10,10,10,10,10,14,14,14,16,17) +B <- c(1,1,1,1,2,1,1,2,1,1,1,1,1,1,2,2,2) +f_res <- Kendall(A,B) + +tidy(f_res) + +### For MannKendall #### +s_res <- MannKendall(B) + +tidy(s_res) + +### For SeasonalMannKendall #### +t_res <- SeasonalMannKendall(ts(A)) + +tidy(t_res) +} +} +\seealso{ +\code{\link[Kendall]{Kendall}} for details on the meaning of each column and implementation. +} diff --git a/tests/testthat/test-kendall.R b/tests/testthat/test-kendall.R new file mode 100644 index 000000000..973f5140b --- /dev/null +++ b/tests/testthat/test-kendall.R @@ -0,0 +1,16 @@ +context("Kendall tidiers") + +test_that("Kendall tidiers work", { + library(Kendall) + A <- c(2.5,2.5,2.5,2.5,5,6.5,6.5,10,10,10,10,10,14,14,14,16,17) + B <- c(1,1,1,1,2,1,1,2,1,1,1,1,1,1,2,2,2) + + f_res <- tidy(Kendall(A,B)) + check_tidy(f_res, exp.row = 1, exp.col = 5) + + s_res <- tidy(MannKendall(A)) + check_tidy(s_res, exp.row = 1, exp.col = 5) + + t_res <- tidy(SeasonalMannKendall(ts(B))) + check_tidy(t_res, exp.row = 1, exp.col = 5) +})