Open jimjam-slam opened 1 month ago
I've also tried following the Creating infiles guide, but that seems to fail faster than manually generating them:
library(tidyverse)
library(rlpi)
library(here)
here("data", "raw", "LPD2022_public.csv") |>
read_csv(na = "NULL") ->
all_data
# this works
all_infile_name <- create_infile(all_data,
index_vector = rep(TRUE, nrow(all_data)),
name = "all_species")
result <- LPIMain(all_infile_name)
# Number of groups: 1
# processing file: all_species_pops.txt
# Calculating LPI for Species
# Number of species: 3626 (in 21260 populations)
# Error in { : task 1 failed - "invalid 'ncol' value (< 0)"
Here's what the infile generated by the package looks like:
"FileName" "Group" "Weighting"
"all_species_pops.txt" 1 1
Here's what the infile generated by my code looks like:
"FileName" "Group" "Weighting"
"data/raw/pop-allspecies-global.tsv" 1 1
Hi there,
I'm trying to calculate LPI using the population CSV file provided from the LPI website.
I've created an infile and a population file from that CSV:
But when I try to run
LPIMain
, I get an error:My infile and popfile are in
/data/raw
. I created both/lpi_temp
and/data/raw/lpi_temp
because I wasn't sure how the package handles the relative links. But I'm not sure if I'm supposed to createbec35d80d781265128fcf2cd203cf3f1_splambda.csv
before runningLPIMain
or if it's an intermediate file that the function is supposed to generate on the way through (I can see that another file ending in_splambda.csv
is generated, but with a different ID prefix).Session info
``` R version 4.3.0 (2023-04-21) Platform: aarch64-unknown-linux-gnu (64-bit) Running under: Ubuntu 22.04.2 LTS Matrix products: default BLAS: /usr/lib/aarch64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/aarch64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: Etc/UTC tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] here_1.0.1 rlpi_0.1.0 lubridate_1.9.3 forcats_1.0.0 [5] stringr_1.5.0 dplyr_1.1.4 purrr_1.0.1 readr_2.1.5 [9] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0 loaded via a namespace (and not attached): [1] Matrix_1.5-4 bit_4.0.5 gtable_0.3.5 jsonlite_1.8.5 [5] crayon_1.5.2 compiler_4.3.0 tidyselect_1.2.1 parallel_4.3.0 [9] splines_4.3.0 scales_1.3.0 lattice_0.21-8 R6_2.5.1 [13] generics_0.1.3 iterators_1.0.14 munsell_0.5.1 rprojroot_2.0.3 [17] pillar_1.9.0 tzdb_0.4.0 rlang_1.1.1 utf8_1.2.3 [21] stringi_1.7.12 doParallel_1.0.17 bit64_4.0.5 timechange_0.3.0 [25] cli_3.6.1 mgcv_1.8-42 withr_2.5.0 magrittr_2.0.3 [29] foreach_1.5.2 grid_4.3.0 vroom_1.6.5 hms_1.1.3 [33] nlme_3.1-162 lifecycle_1.0.3 vctrs_0.6.5 glue_1.6.2 [37] codetools_0.2-19 fansi_1.0.4 colorspace_2.1-0 tools_4.3.0 [41] pkgconfig_2.0.3 ```