matloff / matloff/regtools

deprecated knnest throws error w/o ref to kNN

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

Nobody has claimed this yet.

Dominant language
R
Stars
124
Forks
33
PR merge metrics
No merged PRs in 30d

Description

knnest throws error in is.data.frame(x) : argument y is missing with no default

Suggestion: change error to 'Deprecated, use kNN instead'

xdata <- preprocessx(x = mlb[,c('Height','Age')] , kmax = 20, xval = F )
kout <- knnest(y = mlb[,'Weight'], xdata = xdata, k = 20)
Error in is.data.frame(x) : argument "y" is missing, with no default

copy paste:

kout <- knnest(y = mlb[,5], xdata = xdata, k = 20)
Error in is.data.frame(x) : argument "y" is missing, with no default
traceback()
7: is.data.frame(x)
6: colMeans(y[nearIdxs, , drop = FALSE])
5: nearf(x[i, ], nearxy[[i]])
4: FUN(X[[i]], ...)
3: lapply(X = X, FUN = FUN, ...)
2: sapply(1:nrow(x), function(i) nearf(x[i, ], nearxy[[i]]))
1: knnest(y = mlb[, 5], xdata = xdata, k = 20)
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] regtools_1.6.0 dummies_1.5.6 data.table_1.14.0 freqparcoord_1.0.1 mvtnorm_1.1-1 FNN_1.1.3
[7] GGally_2.1.1 ggplot2_3.3.3 nvimcom_0.9-113

Contributor guide

No contributing guide indexed for this repository

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 knnest entry point and reproduce the reported call using preprocessx, mlb, and k = 20. The work is done when calling knnest no longer produces the internal is.data.frame error and instead reports that it is deprecated and kNN should be used.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.