jmgirard / circumplex

R Package for the Analysis and Visualization of Circumplex Data
http://circumplex.jmgirard.com/
Other
11 stars 6 forks source link

Error in `purrr::map_dbl()` caused by error in `quantile.default()`: ! missing values and NaN's not allowed if 'na.rm' is FALSE #21

Closed r-ola closed 9 months ago

r-ola commented 9 months ago

While I was using circumplex package I got the following error message:

Error in **purrr::map_dbl()**:
ℹ In index: 1.
ℹ With name: t1.
Caused by error in **quantile.default()**:
! missing values and NaN's not allowed if 'na.rm' is FALSE

I tried to analyse circumplex data using this code:

res.a1 <- ssm_analyze(.data = df.area1, 
    scales = c(a.pos1, v.neg1, a.neg1, v.pos1),                          
    angles = c(90, 180, 270, 360),
    measures = c(safe1, inter1), 
    measures_labels = c('Safety', 'Interaction')) 
summary(res.a1)

This is the backtrace:

Backtrace:
 1. ├─circumplex::ssm_analyze(...)
 2. │ └─circumplex:::ssm_analyze_corrs(...)
 3. │   └─circumplex:::ssm_bootstrap(...)
 4. │     └─... %\>% dplyr::select(-fit_lci)
 5. ├─dplyr::select(., -fit_lci)
 6. ├─circumplex (local) reshape_params(., suffix = "lci")
 7. │ └─... %\>% tibble::as_tibble(nrow = nrow(.))
 8. ├─tibble::as_tibble(., nrow = nrow(.))
 9. ├─base::`colnames<-`(...)
10. │ └─base::is.data.frame(x)
11. ├─base::matrix(., ncol = 6, byrow = TRUE)
12. └─purrr::map_dbl(., .f = quantile, probs = ((1 - interval)/2))
13. └─purrr:::map\_("double", .x, .f, ..., .progress = .progress)
14.     ├─purrr:::with_indexed_errors(...)
15.     │ └─base::withCallingHandlers(...)
16.     ├─purrr:::call_with_cleanup(...)
17.     ├─stats (local) .f(.x[[i]], ...)
18.     └─stats:::quantile.default(.x[[i]], ...)
19.       └─base::stop("missing values and NaN's not allowed if 'na.rm' is FALSE")
Run rlang::last_trace(drop = FALSE) to see 4 hidden frames.

There are no missing values nor NaNs in my dataframe.

Dataframe sample:

id        v.neg1        v.pos1     a.neg1       a.pos1       inter1   safe1

1   -0.1031421  -1.7056656  -1.6342515  -0.2935107  6   5

2   -0.1031421  -0.7625329  0.9694712   -0.2935107  5   7

3   -0.1031421  0.1805999   0.3185405   -0.2935107  7   8

4   9.5922176   1.1237326   0.3185405   -0.2935107  3   8

5   -0.1031421  0.1805999   0.3185405   -0.2935107  5   8

6   -0.1031421  1.1237326   0.9694712   -0.2935107  8   8

7   -0.1031421  -0.7625329  -1.6342515  -0.2935107  5   5

8   -0.1031421  -1.7056656  -1.6342515  -0.2935107  4   5

9   -0.1031421  0.1805999   -1.6342515  -0.2935107  6   7

10  -0.1031421  2.0668654   0.9694712   -0.2935107  9   9

How can I resolve this error? Thank you in advance!

jmgirard commented 9 months ago

Can you confirm you have the newest version of circumplex installed?

jmgirard commented 9 months ago

Can you please email me (me@jmgirard.com) either your exact dataframe or a subset or an MRE that produces the problem (ideally as an RDS file via writeRDS())? I can then track down the problem and report back.