Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get rid code when printing summary in rpy2
    primarykey
    data
    text
    <p>I write this code to get Dunnet anova post hoc test</p> <pre><code>import rpy2.robjects as ro import rpy2.robjects.numpy2ri as npr from rpy2.robjects.numpy2ri import numpy2ri as np2r from rpy2.robjects.packages import importr base = importr("base") stats = importr('stats') multcomp = importr('multcomp') val = np2r(vFC) exp = base.gl(4,6,24) tiempo = base.factor(base.rep(base.c(0,2,5,10,15,30),4)) fmla = ro.Formula('val ~ tiempo + exp') env = fmla.environment env['val'] = val env['tiempo'] = tiempo env['exp'] = exp anova = stats.aov(fmla) print base.summary(anova) Phoc = multcomp.glht(anova, linfct = ro.r('mcp(tiempo="Dunnet")')) sPhoc = base.summary(Phoc) print sPhoc </code></pre> <p>Works fine but form the output I get sourcecode after the analysis, how can I get rid from that code and get only the final table from Dunnet analysis. </p> <pre><code> Df Sum Sq Mean Sq F value Pr(&gt;F) tiempo 5 91172 18234 8.788 0.000464 *** exp 3 49402 16467 7.936 0.002108 ** Residuals 15 31125 2075 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Simultaneous Tests for General Linear Hypotheses Multiple Comparisons of Means: Dunnett Contrasts Fit: function (formula, data = NULL, projections = FALSE, qr = TRUE, contrasts = NULL, ...) { Terms &lt;- if (missing(data)) terms(formula, "Error") else terms(formula, "Error", data = data) indError &lt;- attr(Terms, "specials")$Error if (length(indError) &gt; 1L) stop(sprintf(ngettext(length(indError), "there are %d Error terms: only 1 is allowed", "there are %d Error terms: only 1 is allowed"), length(indError)), domain = NA) lmcall &lt;- Call &lt;- match.call() lmcall[[1L]] &lt;- as.name("lm") lmcall$singular.ok &lt;- TRUE if (projections) qr &lt;- lmcall$qr &lt;- TRUE lmcall$projections &lt;- NULL if (is.null(indError)) { fit &lt;- eval(lmcall, parent.frame()) if (projections) fit$projections &lt;- proj(fit) class(fit) &lt;- if (inherits(fit, "mlm")) c("maov", "aov", oldClass(fit)) else c("aov", oldClass(fit)) fit$call &lt;- Call return(fit) } else { if (pmatch("weights", names(match.call()), 0L)) stop("weights are not supported in a multistratum aov() fit") opcons &lt;- options("contrasts") options(contrasts = c("contr.helmert", "contr.poly")) on.exit(options(opcons)) allTerms &lt;- Terms errorterm &lt;- attr(Terms, "variables")[[1 + indError]] eTerm &lt;- deparse(errorterm[[2L]], width.cutoff = 500L, backtick = TRUE) intercept &lt;- attr(Terms, "intercept") ecall &lt;- lmcall ecall$formula &lt;- as.formula(paste(deparse(formula[[2L]], width.cutoff = 500L, backtick = TRUE), "~", eTerm, if (!intercept) "- 1"), env = environment(formula)) ecall$method &lt;- "qr" ecall$qr &lt;- TRUE ecall$contrasts &lt;- NULL er.fit &lt;- eval(ecall, parent.frame()) options(opcons) nmstrata &lt;- attr(terms(er.fit), "term.labels") nmstrata &lt;- sub("^`(.*)`$", "\\1", nmstrata) nmstrata &lt;- c("(Intercept)", nmstrata) qr.e &lt;- er.fit$qr rank.e &lt;- er.fit$rank if (rank.e &lt; length(er.fit$coefficients)) warning("Error() model is singular") qty &lt;- er.fit$residuals maov &lt;- is.matrix(qty) asgn.e &lt;- er.fit$assign[qr.e$pivot[1L:rank.e]] maxasgn &lt;- length(nmstrata) - 1L nobs &lt;- NROW(qty) if (nobs &gt; rank.e) { result &lt;- vector("list", maxasgn + 2L) asgn.e[(rank.e + 1):nobs] &lt;- maxasgn + 1L nmstrata &lt;- c(nmstrata, "Within") } else result &lt;- vector("list", maxasgn + 1L) names(result) &lt;- nmstrata lmcall$formula &lt;- form &lt;- update(formula, paste(". ~ .-", deparse(errorterm, width.cutoff = 500L, backtick = TRUE))) Terms &lt;- terms(form) lmcall$method &lt;- "model.frame" mf &lt;- eval(lmcall, parent.frame()) xvars &lt;- as.character(attr(Terms, "variables"))[-1L] if ((yvar &lt;- attr(Terms, "response")) &gt; 0L) xvars &lt;- xvars[-yvar] if (length(xvars)) { xlev &lt;- lapply(mf[xvars], levels) xlev &lt;- xlev[!sapply(xlev, is.null)] } else xlev &lt;- NULL resp &lt;- model.response(mf) qtx &lt;- model.matrix(Terms, mf, contrasts) cons &lt;- attr(qtx, "contrasts") dnx &lt;- colnames(qtx) asgn.t &lt;- attr(qtx, "assign") if (length(wts &lt;- model.weights(mf))) { wts &lt;- sqrt(wts) resp &lt;- resp * wts qtx &lt;- qtx * wts } qty &lt;- as.matrix(qr.qty(qr.e, resp)) if ((nc &lt;- ncol(qty)) &gt; 1) { dny &lt;- colnames(resp) if (is.null(dny)) dny &lt;- paste0("Y", 1L:nc) dimnames(qty) &lt;- list(seq(nrow(qty)), dny) } else dimnames(qty) &lt;- list(seq(nrow(qty)), NULL) qtx &lt;- qr.qty(qr.e, qtx) dimnames(qtx) &lt;- list(seq(nrow(qtx)), dnx) for (i in seq_along(nmstrata)) { select &lt;- asgn.e == (i - 1) ni &lt;- sum(select) if (!ni) next xi &lt;- qtx[select, , drop = FALSE] cols &lt;- colSums(xi^2) &gt; 1e-05 if (any(cols)) { xi &lt;- xi[, cols, drop = FALSE] attr(xi, "assign") &lt;- asgn.t[cols] fiti &lt;- lm.fit(xi, qty[select, , drop = FALSE]) fiti$terms &lt;- Terms } else { y &lt;- qty[select, , drop = FALSE] fiti &lt;- list(coefficients = numeric(), residuals = y, fitted.values = 0 * y, weights = wts, rank = 0L, df.residual = NROW(y)) } if (projections) fiti$projections &lt;- proj(fiti) class(fiti) &lt;- c(if (maov) "maov", "aov", oldClass(er.fit)) result[[i]] &lt;- fiti } result &lt;- result[!sapply(result, is.null)] class(result) &lt;- c("aovlist", "listof") if (qr) attr(result, "error.qr") &lt;- qr.e attr(result, "call") &lt;- Call if (length(wts)) attr(result, "weights") &lt;- wts attr(result, "terms") &lt;- allTerms attr(result, "contrasts") &lt;- cons attr(result, "xlevels") &lt;- xlev result } }(formula = val ~ tiempo + exp) Linear Hypotheses: Estimate Std. Error t value Pr(&gt;|t|) 2 - 0 == 0 78.10 32.21 2.425 0.10346 5 - 0 == 0 152.39 32.21 4.731 0.00113 ** 10 - 0 == 0 140.06 32.21 4.348 0.00246 ** 15 - 0 == 0 158.90 32.21 4.933 &lt; 0.001 *** 30 - 0 == 0 180.73 32.21 5.611 &lt; 0.001 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Adjusted p values reported -- single-step method) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload