datacamp / datacamp/rdocumentation-2.0

Issue: Error in comparison of `mean.vect` and `censoring.thr` due to length mismatch in function of model.selector

Open
#171 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
301
Forks
54
Avg merge
16h 19m
Merged PRs (30d)
1

Description

First of all, thank you for developing and maintaining this great package! It's been really helpful for my analysis. However, I encountered the following error while running the function:

Error in mean.vect > censoring.thr: 
(converted from warning) longer object length is not a multiple of shorter object length

This occurs during the execution of the following block of code:

if (max(obj.fnc) > 0) {
    censoring.thr = support[which(obj.fnc == max(obj.fnc))]  # Set threshold
} else {
    censoring.thr = min.support - 1
}
model.selector[which(mean.vect > censoring.thr)] = 1
length(censoring.thr)

[1] 6

length(mean.vect)

[1] 2981

The error is caused by a length mismatch between mean.vect and censoring.thr. The error message indicates that the comparison between mean.vect (which is a vector with length equal to the number of features) and censoring.thr (which is a scalar) results in a length mismatch during the comparison mean.vect > censoring.thr.

Environment:

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Looking forward to any suggestions or fixes!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the model.selector function and reproduce the reported comparison using the lengths shown for mean.vect and censoring.thr. Inspect how censoring.thr is produced from support and obj.fnc, then verify the intended length relationship. Done means the reported input no longer emits the length-mismatch warning and model.selector has the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.