Error: invalid type (list) for variable 'I(W^1)'
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 183
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
**Issue:**
Got the following error message when only one feature is passed into the function polyFit().
"
getPoly() expects a matrix or a data.frame. The input will be coerced to a data.frame but you may wish to stop and provide one directly.
Error in t.default(xdata) : argument is not a matrix
In addition: Warning message:
In model_matrix(modelFormula, W, intercept, noisy, ...) :
model.matrix() reported the following error:
Error in model.frame.default(object, data, xlev = xlev) :
invalid type (list) for variable 'I(W^1)'
"
**Code for reproducing the problem:**
y <- as.factor(rep(c(0,1,1),20))
s <- rnorm(length(y))
dta <- data.frame(scores = s, y=y)
polyFit(dta,deg=1,use='glm')
**I tried the following and it seems the function works for two features**
dta2 <- data.frame(scores = s,scores_two = sort(s), y=y)
polyFit(dta2,deg=1,use='glm')
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported polyFit(dta, deg=1, use='glm') reproduction with the single-feature data frame, then compare it with the working two-feature example. Trace the polyFit, getPoly, and model_matrix path associated with the model.matrix() error; done means the single-feature call completes without the reported invalid-list or non-matrix errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100