Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument .keep.org.data not working #56

Open
FinYang opened this issue Aug 28, 2022 · 2 comments
Open

Argument .keep.org.data not working #56

FinYang opened this issue Aug 28, 2022 · 2 comments

Comments

@FinYang
Copy link

FinYang commented Aug 28, 2022

Hi there,

Please see below the repro. The examples are taken from documentation of embed.

library(dimRed)
#> Loading required package: DRR
#> Loading required package: kernlab
#> Loading required package: CVST
#> Loading required package: Matrix
#> 
#> Attaching package: 'dimRed'
#> The following object is masked from 'package:stats':
#> 
#>     embed
#> The following object is masked from 'package:base':
#> 
#>     as.data.frame

as.data.frame(
  embed(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width,
        iris, "PCA", .keep.org.data = FALSE)
)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': invalid class "dimRedResult" object: invalid object for slot "org.data" in class "dimRedResult": got class "NULL", should be or extend class "matrix"

as.data.frame(embed(iris[, 1:4], "PCA", .keep.org.data = FALSE))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': invalid class "dimRedResult" object: invalid object for slot "org.data" in class "dimRedResult": got class "NULL", should be or extend class "matrix"

Created on 2022-08-28 by the reprex package (v2.0.1)

@gdkrmr
Copy link
Owner

gdkrmr commented Aug 29, 2022

I can confirm it, thanks for reporting!

FYI: it keeps the original data if you omit .keep.org.data.

@gdkrmr
Copy link
Owner

gdkrmr commented Aug 30, 2022

in dimRedResults-class, the slot org.data can only be of class matrix, so I cannot just use a NULL. Should getOrgData and getData return a 0-column matrix silently or throw an error or a warning if the original data is not saved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants