The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
gofigR is the R client for https://gofigr.io, a zero-effort reproducibility engine. It works with any R library which outputs to R graphics devices.
gofigR integrates with R markdown, both in knitr
and in
interactive sessions in RStudio. GoFigr also works in scripts. We tested
with R 4.3.2 but any reasonably recent version should work.
library(devtools)
::install_github("gofigr/gofigR") devtools
On the R prompt, simply load the gofigR
package and call
gfconfig()
. You only need to do this once.
If you don’t have an account, you can register at https://app.gofigr.io/register.
> library(gofigR)
Attaching package: ‘gofigR’
> gfconfig()
-------------------------------------------------------------------
Welcome to GoFigr! This wizard will help you get up and running.
-------------------------------------------------------------------
Username: publicdemo
Testing connection...
=> Success
API key (leave blank to generate a new one):
Key name (e.g. Alyssa's laptop): my API key
Fetching workspaces...
1. Scratchpad - e5249bed-40f0-4336-9bd3-fef30d3ed10d
Please select a default workspace (1-1): 1
Configuration saved to /Users/maciej/.gofigr. Happy analysis!
To enable GoFigr, simply call enable
in your setup
chunk. You can also optionally specify an analysis_name
(it
will be created automatically if it doesn’t exist).
```{r setup, include=FALSE}
library(gofigR)
gofigR::enable()
```
To publish plots, simply call publish
:
<- Heatmap(matrix(rnorm(100), nrow=10, ncol=10))
hm1
publish(hm1, "Heatmaps are cool!") # second argument is the figure name
# This works, too
%>% publish("Heatmaps are cool!") hm1
To capture output from base R plotting, call publish
with a plotting expression:
::publish({
gofigR::plot(pressure, main="Pressure vs temperature")
basetext(200, 50, "Note the non-linear relationship")
data=pressure, figure_name="Pressure vs temperature")
},
::publish({
gofigR# The mtcars dataset:
<- as.matrix(mtcars)
data
<- colorRampPalette(brewer.pal(8, "PiYG"))(25)
coul heatmap(data, scale="column", col = coul, main="Visualizing mtcars")
data=mtcars, figure_name="Cars") },
Note the optional data
argument following the
expression. It specifies the data which you want to associate with the
figure – it will show up under “files” (as .RDS
) once
published.
You can replace plotOutput + renderPlot
with
gfPlot + gfPlotServer
and give your users the ability to
publish interactive plots to GoFigr. For example:
library(shiny)
library(gofigR)
::enable()
gofigR
# Define UI for application that draws a histogram
<- fluidPage(
ui # Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
gfPlot("distPlot"),
)
)
)
# Define server logic required to draw a histogram
<- function(input, output) {
server
gfPlotServer("distPlot", {
# generate bins based on input$bins from ui.R
<- faithful[, 2]
x <- seq(min(x), max(x), length.out = input$bins + 1)
bins
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white',
xlab = 'Waiting time to next eruption (in mins)',
main = 'Histogram of waiting times')
figure_name="Old faithful waiting times")
}, input,
}
# Run the application
shinyApp(ui = ui, server = server)
Note that we pass input
to gfPlotServer
.
This will capture your current Shiny inputs – they will become available
under the “Metadata” tab in GoFigr.
We support knitr
as well as interactive sessions in
RStudio
.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.