Building a user interface for spatstat

[This article was first published on spatialRecology - r, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



RStudio developed shiny, an R package that, quoting from their website, “makes it super simple for R users like you to turn analyses into interactive web applications that anyone can use”.
It leverages the power of R and its vast collection of packages to allow users to efficiently perform predesigned data tasks, such as visualization and/or statistics.
Plus, shiny seems to be the new hypetrain of R, which is why I will jump right on it.

This post will introduce “shiny_spatstat”, a user interface for spatstat.
It is meant to be accessible for people that want to perform basic point pattern analyses.

In general are there two main areas for integrating shiny in my work:

  • Building an user interface for ecological models to control parameters and observe simulation runnings (comparable to NetLogo)
  • Writing an application for an audience that is not that familiar with R or the method you want to present, i.e. as standalone analysis tool for tailored questions or a chance to let students explore a dataset in an interactive way

The aim of this post is not to take you step-by-step through the construction of a reasonably full-featured simulation app.
It is rather publishing the first, rough version (v0.1) of an app I had in mind for quite some time now.
At this time, I view this app (with different data) as a companion to a poster I will present at an ecology conference in September.
However, during coding the app I had a lot of ideas on how to further develop it and I hope to be able to produce something comparable to Programita in the end.

Enough of words, see shiny_spatstat here:

You can view the running app in fullscreen here (recommended).

Get and run it!

A Shiny basically consists of two files: a ui.r file and a server.r file. The ui.r file, as it says, provides the user interface, and the server.r file provides the server logic. These are the two main files you want to customize shiny_spatstat.
Rstudio has a great tutorial for the basics.

To run the user interface locally:


… or download it from:


In conclusion, the idea is to develop a shiny app as a user interface for spatstat.
shiny_spatstat (v1) should therefore be able to load datasets dynamically and allow to carry out the appropriate statistics.

Further things to do:

Find a hipper name

Load dynamically input files

More statistics

Progressbar for simulation runs

Exchange base R plots with interactive plots

Own CSS, for a distinct look

In subsequent posts I’ll outline the updates in the development being made in this app.
If you have feedback or suggestions for improvements, comment here or post an Issue on the GitHub site.

To leave a comment for the author, please follow the link and comment on their blog: spatialRecology - r. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)