SomaLogic / SomaDataIO

The SomaDataIO package loads and exports 'SomaScan' data via the 'SomaLogic Operating Co., Inc.' proprietary data file, called an ADAT ('*.adat'). The package also exports auxiliary functions for manipulating, wrangling, and extracting relevant information from an ADAT object once in memory.
https://somalogic.github.io/SomaDataIO/
Other
26 stars 18 forks source link

stat-two-group-comparison error #133

Closed john-alexander closed 2 months ago

john-alexander commented 2 months ago

Hi I'm new here - trying to follow the example data from the package and ran into the following erroor

https://somalogic.github.io/SomaDataIO/articles/stat-two-group-comparison.html

` library(SomaDataIO)

the example_data package data

dim(example_data)

> [1] 192 5318

table(example_data$SampleType)

>

> Buffer Calibrator QC Sample

> 6 10 6 170

center/scale

cs <- function(.x) { # .x = numeric vector out <- .x - mean(.x) # center out / sd(out) # scale }

prepare data set for analysis

cleanData <- example_data |> filter(SampleType == "Sample") |> # rm control samples drop_na(Sex) |> # rm NAs if present log10() |> # log10-transform (Math Generic) modify_at(getAnalytes(example_data), cs) # center/scale analytes `

Error in modify_at(log10(drop_na(filter(example_data, SampleType == "Sample"), : could not find function "modify_at"

sessionInfo() R version 4.4.1 (2024-06-14) Platform: x86_64-conda-linux-gnu Running under: Rocky Linux 8.9 (Green Obsidian)

Matrix products: default BLAS/LAPACK: /tmp_mnt/filer1/software/bioinf/.conda/envs/r_4.4.1/lib/libopenblasp-r0.3.27.so; LAPACK version 3.12.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: Europe/London tzcode source: system (glibc)

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] SomaDataIO_6.1.0

loaded via a namespace (and not attached): [1] tidyr_1.3.1 utf8_1.2.4 R6_2.5.1 cellranger_1.1.0 [5] tidyselect_1.2.1 readxl_1.4.3 magrittr_2.0.3 glue_1.7.0 [9] tibble_3.2.1 pkgconfig_2.0.3 dplyr_1.1.4 generics_0.1.3 [13] lifecycle_1.0.4 cli_3.6.3 fansi_1.0.6 vctrs_0.6.5 [17] compiler_4.4.1 httr_1.4.7 tools_4.4.1 purrr_1.0.2 [21] pillar_1.9.0 rlang_1.1.4

scheidec commented 2 months ago

Hi @john-alexander. Thanks for sharing your session info. It looks like you have not attached the purrr package which includes the modify_at() function that is not being found in your environment. If you view the source code of the two-group comparison vignette, you'll see that other packages, including purrr, are required to be loaded in order to execute the code contained in that vignette. Once you load the external packages, you should be able to run all of the code for the two-group comparison example.

john-alexander commented 2 months ago

Apologies, I missed the very nice source link at the top of page! Works for me now :-)