A Shiny app to open, examine and manipulate NMD Biotic xml files used by the Institute of Marine Research Norway
This is a prototype of the Biotic Explorer Shiny app allowing examination and manipulation of the Norwegian Maritime Data-center (NMD) standard xml files, which are used within the Institute of Marine Research database. While the application is developed by the Institute of Marine Research, this is not the official version of the application and is bound to contain bugs and other errors.
The app requires R and RStudio. Install these software on your computer following the instructions on the respective webpages. Open RStudio and install the Shiny package:
install.packages("shiny")
Biotic Explorer uses the new RstoxData package, which currently is only available on GitHub. On Unix computers and on Windows machines with a working C++ compiler (Rtools), you can install the package directly from GitHub using the devtools package (devtools::install_github("StoXProject/RstoxData")
).
On computers that return errors when trying to run the Rtools through RStudio (most institutional Windows machines), install the binary directly from here. Download the newest RstoxData zip file, click the "Packages" tab -> "Install" -> "Install from:" "Package Archive File" -> "Install". If the installer does not complain, the package is installed correctly.
As long as your C++ compiler or the RstoxData package work, running the app for the first time automatically installs and loads packages used by the app.
Once you have the RstoxData package installed, you can run the app. Write:
library(shiny)
shiny::runGitHub("BioticExplorer", "MikkoVihtakari")
Click "Clone or download" -> "Download ZIP". Find the zip file (typically in your Downloads folder) and extract it to a desired location. Open the app.R file in RStudio and click "Run app".
This is a common problem on IMR Windows computers and can now be avoided by installing a binary version of the RstoxData package (see above). If you want to get the C++ compiler to run on your machine, you need to install Rtools (only under Windows - the compiler is already installed on Unix machines). When you install Rtools, make sure to tick the "edit the system PATH" option. Restart RStudio, load devtools (library(devtools)
) and see what find_rtools()
returns (should be TRUE). There are numerous reported issues when trying to get the compiler to work. These issues are often caused because the development software for R (Rtools and pkgbuild) drag behind the R releases on Windows. See here, here, and here. Also setting options(buildtools.check = NULL)
in RStudio sometimes works.
- Upload data: Click 'Browse..' and select an xml file from your computer. An overview of data and sampling station locations will be shown under. You can use the available options to remove data that are not relevant.
- Filter data: Use the 'Filter data by' options to select data you want to keep. Click the 'Subset' button once you are ready and see how the overview will change based on the information you selected.
- You can examine the station and catch data by clicking the 'Stations & catches' tab. Use the 'Overview' sub-tab for a graphical overview or the 'Examine' tab for a tabular overview, which you can filter and search as you wish, but note that filtering here does not influence the returned data.
- Similarly, an overview of individual measured fish is given under 'Individuals & ages' tab.
- 'Mission data' through 'Age data' tabs give a tabular overview of each data type in the NMD xml Biotic file.
- Download filtered data using the 'Download' tab. Select the format you want to download in (R, csv or Excel). If you select multiple data types, note that the csv format will be returned as a zip file.
Any contributions to the app are more than welcome. Please contact the app creator Mikko Vihtakari (mikko.vihtakari@hi.no) to discuss your ideas on improving the app.
Running the app automatically installs following packages:
- shinyFiles. Used to up- and download files.
- shinydashboard. Used for the dashboard.
- DT. Used for data tables.
- tidyverse. Used for data manipulation and plots.
- RstoxData. Used to read NMD .xml files.
- devtools. Used to download the RNMDAPI package.
- leaflet. Used for interactive maps.
- openxlsx. Used to write MS Excel files.
2019-07-11 Fixed a number of Windows related problems. The app should (hopefully) work now on most institutional machines.
2019-07-08 Uploaded the first alpha version. The app works, but does not contain all features yet. This version is meant for internal testing.