September 08–12, 2025

json
purrr
Published

September 8, 2025

FIMS hex icon and noaa logo with text saying FIMS Weekly

THREE BIG THINGS THIS WEEK

  1. On Wednesday, the Science Board will be given an update and we will discuss creating a formal FIMS Transition Plan. Thank you Jane for volunteering to attend the presentation to help take notes.

  2. None of the PRs that I wanted to merge in last week happened so merging those is a goal again. Attend Code Club on Tuesday if you are interested in helping write R code to read in the json output.

  3. By the end of the day on Wednesday there will be a prioritized list of issues that need completed before October 01, 2025 because they are needed for the documentation that will be sent to the CIE Reviewers.

FIMS ANNOUNCEMENTS

  • Please welcome 👋 Adrianne Wilson 👋 to the FIMS Team!
  • 57 calendar days until the FIMS CIE Review, we now have a chair.

UPCOMING EVENTS

Tuesday, json in R

FIMS Code Club Time: 13:00–14:00 E; 10:00–11:00 P; 9:00–10:00 AK; 7:00–8:00 H Location: Virtual Online: Google Meet

Thursday, data and seasonality

FIMS Seaside Chat Time: 13:00–14:00 E; 10:00–11:00 P; 9:00–10:00 AK; 7:00–8:00 H Location: Virtual Online: Google Meet

PHOTO OF THE WEEK

Last week I showed the json output for dimensionality, this week I show the tidyverse code to create a tibble from that same information.

#' Covert the dimension information from a FIMS json output into a tibble
#'
#' Dimensions in the json output are stored as a list of length two, with the
#' header information containing the name of the dimension and the dimensions
#' containing integers specifying the length for each dimension. The result
#' helps interpret how the FIMS output is structured given it is dimension
#' folded into a single vector in the json output.
#'
#' @param data A list containing the header and dimensions information from a
#'   FIMS json output object.
#' @return
#' A tibble containing ordered rows for each combination of the dimensions.
#' @examples
#' dummy_dimensions <- list(
#'   header = list("nyears", "nages"),
#'   dimensions = list(30L, 12L)
#' )
#' dimensions_to_tibble(dummy_dimensions)
dimensions_to_tibble <- function(data) {
  # Create names that are informative for columns b/c nyears is not helpful
  better_names <- unlist(data[["header"]]) |>
    gsub(pattern = "^n(.+)s$", replacement = "\\1_ids")
  names(data[["dimensions"]]) <- better_names
  # Create the returned tibble by first sequencing from 1:n for each dimension
  data[["dimensions"]] |>
    purrr::map(seq) |>
    expand.grid() |>
    tibble::as_tibble() |>
    dplyr::arrange(!!! rlang::syms(better_names))
}