knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE, purl = FALSE )
The Mellio R bridge moves statistical results from R into Mellio's Stats workspace as structured Result Cards that can be saved, formatted, and used in a manuscript.
This vignette walks through the common workflow.
By default, mellio_open() opens the hosted Mellio app at
https://www.mellioapp.com.
# Advanced users can point this at a trusted Mellio deployment: # options(mellio.editor_url = "https://www.mellioapp.com")
The R payload is encoded in the URL fragment. URL fragments are not sent as HTTP requests to the server, but the full URL can still be visible to the browser, the opened web app, browser history, extensions, and anyone the URL is shared with.
mellio_open() builds a Result Card from a supported R object and opens
it in your browser.
library(mellio) # Welch's two-sample t-test mellio_open(t.test(extra ~ group, data = sleep)) # Pearson correlation mellio_open(cor.test(mtcars$mpg, mtcars$wt)) # Chi-squared M <- matrix(c(10, 20, 30, 40), nrow = 2) mellio_open(chisq.test(M))
The card shows the test statistic, df, p-value, and effect when available, formatted in APA 7 style.
m1 <- lm(mpg ~ wt + cyl, data = mtcars) mellio_open(m1) m2 <- lm(mpg ~ wt + cyl + hp, data = mtcars) mellio_open(anova(m1, m2)) # nested model comparison
library(lme4) mellio_open(lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy))
lmer and glmer cards show AIC, logLik, and N inline (lavaan
gets full fit indices below).
library(lavaan) HS.model <- "visual =~ x1 + x2 + x3 textual =~ x4 + x5 + x6 speed =~ x7 + x8 + x9" fit <- cfa(HS.model, data = HolzingerSwineford1939) mellio_open(fit)
You'll see a structural card with two zones:
=~ loadings, ~ regressions, ~~ (co)variances,
~1 intercepts, := defined parameters)Pre-mark focal paths so they surface in the report zone:
mellio_open(fit, focal = c("visual =~ x1", "textual =~ x4"))
For variable summaries:
mellio_open(mtcars$mpg, name = "Fuel efficiency (mpg)") # Or from summary() output mellio_open(summary(mtcars$mpg))
The card shows M, SD, N, and range.
Each Result Card carries:
print() for auditLocal provenance fields such as user name, host name, working directory, git state, and script path are opt-in:
options(mellio.provenance = "full")
Set options(mellio.provenance = FALSE) to omit provenance metadata.
The Save to Library button on the card persists it. When you're signed into Mellio, cards sync to your account and follow you across devices. When you're not signed in, cards live in browser localStorage.
The Library lists everything you've saved with search and type filters. Click any card to reopen it.
From the Library view:
Once mellio is loaded, RStudio's Addins menu gets a
Send to Mellio entry. Highlight an R expression (t.test(...))
and run the addin — same effect as typing mellio_open().
mellio_open() opens a browser, which is interactive. For scripts and
knitr documents, use mellio_payload() to get the JSON payload directly
without launching a browser:
p <- mellio_payload(t.test(extra ~ group, data = sleep)) mellio_to_json(p, pretty = TRUE)
Use citation("mellio") for the package citation.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.