b-cubed-eu / b3gbi

B-Cubed General Biodiversity Indicators
https://b-cubed-eu.github.io/b3gbi/
Other
0 stars 1 forks source link

Allow dataframe input for `process_cube()`. #15

Open wlangera opened 3 weeks ago

wlangera commented 3 weeks ago

Currently, the process_cube() function only accepts file paths although the input of a dataframe (as an R object) might be usefull as well. For example if you first want to filter or modify the data. The current error message might also require a cleanup.

library(b3gbi)

# Read in data cube
denmark_cube_df <- read.delim(
    system.file("extdata", "denmark_mammals_cube_eqdgc.csv", package = "b3gbi"))

# Filter data based on uncertainty and year
denmark_cube_filtered <- subset(denmark_cube_df,
                                mincoordinateuncertaintyinmeters < 500 &
                                    year >= 2000)

# Process data cube
process_cube(denmark_cube_filtered)
#> Error in `vroom::vroom()`:
#> ! `file` is not one of the supported inputs:
#> • A filepath or character vector of filepaths
#> • A connection or list of connections
#> • Literal or raw input

Created on 2024-07-03 with reprex v2.1.0

wlangera commented 3 weeks ago

This feature will also help for inplementation of the gcube workflow into b3gbi (still figuring this out).