inst/doc/grumpy.R

## ----setup--------------------------------------------------------------------
library(grumpy)


## -----------------------------------------------------------------------------
read_npy(system.file("extdata", "test_2d.npy", package = "grumpy"))


## -----------------------------------------------------------------------------
read_npz(system.file("extdata", "test.npz", package = "grumpy"))

# we can read only some of the arrays in the archive
read_npz(
  system.file("extdata", "test.npz", package = "grumpy"),
  arrays = "x"
)
# or equivalently
read_npz(
  system.file("extdata", "test.npz", package = "grumpy"),
  arrays = 1L
)


## -----------------------------------------------------------------------------
struct <- read_npy(
  system.file("extdata", "test_structured.npy", package = "grumpy")
)
struct
dim(struct)
struct[[1L]]


## -----------------------------------------------------------------------------
unlist(struct) |>
  matrix(ncol = length(struct[[1L]]), byrow = TRUE) |>
  as.data.frame()

Try the grumpy package in your browser

Any scripts or data that you put into this service are public.

grumpy documentation built on Nov. 16, 2026, 5:07 p.m.