Hello
This may be more of a stats question, but I thought I'd try my luck here.
I am trying to inspect data using a new package ZIBPPCA (equivalent to PCA for Zero-inflated data). More for data exploration than dimension reduction.
But I get the error "Error in while ((difllike > pres) && (i <= maxit)) {: missing value where TRUE/FALSE needed" (see reprex).
A regular PCA would be suboptimal because my data has a lot of zeros.
Does anyone have any experience with this sort of problem or with running this function?
Any help would be greatly appreciated.
library(styler)
library(reprex)
library(tidyverse)
# install_github("khellton/zibppca")
library(devtools)
#> Loading required package: usethis
library(zibppca)
setwd("C:/Users/")
All.SCL.TL <- read.csv("C:/Users/All.SCL.TL.csv")
# remove col X
All.SCL.TL$X <- NULL
#check data structure
str(All.SCL.TL)
#> 'data.frame': 215 obs. of 5 variables:
#> $ L : num 23.1 20.6 24.2 26.8 23.7 ...
#> $ BPAT: num 45.4 41.5 42.7 43.3 47.5 ...
#> $ FLT : num 50.9 47 50.7 49.7 50.4 ...
#> $ dBPT: num 12.79 8.69 0 6.37 14.43 ...
#> $ tBP : int 1 1 0 2 2 1 3 0 2 0 ...
#check for NA values
colSums(is.na(All.SCL.TL))
#> L BPAT FLT dBPT tBP
#> 0 0 0 0 0
#no NA values in dataframe
#generate PCA
pcaSCL.TL <- zibppca(All.SCL.TL, scale. = TRUE)
#> [1] "Analyzing data with 5 variables and 215 observations"
#> Error in while ((difllike > pres) && (i <= maxit)) {: missing value where TRUE/FALSE needed
Created on 2021-11-17 by the reprex package (v2.0.1)
Session info
sessioninfo::session_info()
#> - Session info --------------------------------------------------------------
#> hash: superhero: light skin tone, pencil, vulcan salute: medium skin tone
#>
#> setting value
#> version R version 4.1.2 (2021-11-01)
#> os Windows 10 x64 (build 19042)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United Kingdom.1252
#> ctype English_United Kingdom.1252
#> tz Africa/Johannesburg
#> date 2021-11-17
#> pandoc 2.14.0.3 @ C:/R/RStudio/bin/pandoc/ (via rmarkdown)
#>
#> - Packages -------------------------------------------------------------------
#> package * version date (UTC) lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.1)
#> backports 1.3.0 2021-10-27 [1] CRAN (R 4.1.1)
#> broom 0.7.10 2021-10-31 [1] CRAN (R 4.1.1)
#> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.1)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.1)
#> cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.1.1)
#> cli 3.1.0 2021-10-27 [1] CRAN (R 4.1.1)
#> colorspace 2.0-2 2021-06-24 [1] CRAN (R 4.1.1)
#> crayon 1.4.2 2021-10-29 [1] CRAN (R 4.1.1)
#> DBI 1.1.1 2021-01-15 [1] CRAN (R 4.1.1)
#> dbplyr 2.1.1 2021-04-06 [1] CRAN (R 4.1.1)
#> desc 1.4.0 2021-09-28 [1] CRAN (R 4.1.1)
#> devtools * 2.4.2 2021-06-07 [1] CRAN (R 4.1.1)
#> digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.1)
#> dplyr * 1.0.7 2021-06-18 [1] CRAN (R 4.1.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.1)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.1)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.1)
#> forcats * 0.5.1 2021-01-27 [1] CRAN (R 4.1.1)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.1)
#> generics 0.1.1 2021-10-25 [1] CRAN (R 4.1.1)
#> ggplot2 * 3.3.5 2021-06-25 [1] CRAN (R 4.1.1)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.1)
#> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.1.1)
#> haven 2.4.3 2021-08-04 [1] CRAN (R 4.1.1)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.1)
#> hms 1.1.1 2021-09-26 [1] CRAN (R 4.1.1)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1)
#> httr 1.4.2 2020-07-20 [1] CRAN (R 4.1.1)
#> jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.1)
#> knitr 1.36 2021-09-29 [1] CRAN (R 4.1.1)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
#> lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.1)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.1)
#> memoise 2.0.0 2021-01-26 [1] CRAN (R 4.1.1)
#> modelr 0.1.8 2020-05-19 [1] CRAN (R 4.1.1)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.1.1)
#> pillar 1.6.4 2021-10-18 [1] CRAN (R 4.1.1)
#> pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.1.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.1)
#> pkgload 1.2.3 2021-10-13 [1] CRAN (R 4.1.1)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.1)
#> processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.1)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.1)
#> purrr * 0.3.4 2020-04-17 [1] CRAN (R 4.1.1)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.1)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.1)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.1)
#> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.1)
#> Rcpp 1.0.7 2021-07-07 [1] CRAN (R 4.1.1)
#> readr * 2.0.2 2021-09-27 [1] CRAN (R 4.1.1)
#> readxl 1.3.1 2019-03-13 [1] CRAN (R 4.1.1)
#> remotes 2.4.1 2021-09-29 [1] CRAN (R 4.1.1)
#> reprex * 2.0.1 2021-08-05 [1] CRAN (R 4.1.1)
#> rlang 0.4.12 2021-10-18 [1] CRAN (R 4.1.1)
#> rmarkdown 2.11 2021-09-14 [1] CRAN (R 4.1.1)
#> rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.1)
#> rvest 1.0.2 2021-10-16 [1] CRAN (R 4.1.1)
#> scales 1.1.1 2020-05-11 [1] CRAN (R 4.1.1)
#> sessioninfo 1.2.1 2021-11-02 [1] CRAN (R 4.1.2)
#> stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.1)
#> stringr * 1.4.0 2019-02-10 [1] CRAN (R 4.1.1)
#> styler * 1.6.2 2021-09-23 [1] CRAN (R 4.1.1)
#> testthat 3.1.0 2021-10-04 [1] CRAN (R 4.1.1)
#> tibble * 3.1.5 2021-09-30 [1] CRAN (R 4.1.1)
#> tidyr * 1.1.4 2021-09-27 [1] CRAN (R 4.1.1)
#> tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.1.1)
#> tidyverse * 1.3.1 2021-04-15 [1] CRAN (R 4.1.1)
#> tzdb 0.2.0 2021-10-27 [1] CRAN (R 4.1.1)
#> usethis * 2.1.3 2021-10-27 [1] CRAN (R 4.1.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.1)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.1)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.1)
#> xfun 0.27 2021-10-18 [1] CRAN (R 4.1.1)
#> xml2 1.3.2 2020-04-23 [1] CRAN (R 4.1.1)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.1)
#> zibppca * 0.0.0.9000 2021-11-17 [1] Github (khellton/zibppca@595c1f8)
#>
#> [1] C:/R/R-4.1.2/library
#>
#> ------------------------------------------------------------------------------