-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Error in createDummyFeatures.data.frame(df, cols = df$var) #2782
Comments
Hi, thanks for posting your issue here. |
Again: Please provide a valid reprex with a code snippet AND format your code so that is readable. Please do not insert screenshots of error message. Thanks. I see you tried using the {reprex} package but did not use it correctly. Please read again how to use it. Thanks. |
Hi there, Sorry for trouble, this is the first time I use "reprex()", I just wanna know how the error generated in my code and how I can crack it? Thanks a lot! df <- data.frame(var = sample(c("A", "B", "C"), 10, replace = TRUE))
df
#> var
#> 1 A
#> 2 C
#> 3 C
#> 4 A
#> 5 C
#> 6 B
#> 7 A
#> 8 C
#> 9 B
#> 10 A
createDummyFeatures(df, cols = "var")
#> Error in createDummyFeatures(df, cols = "var"): could not find function "createDummyFeatures" Created on 2020-08-24 by the reprex package (v0.3.0) Session infodevtools::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.0.0 (2020-04-24)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language en
#> collate Chinese (Simplified)_China.936
#> ctype Chinese (Simplified)_China.936
#> tz Asia/Taipei
#> date 2020-08-24
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0)
#> backports 1.1.7 2020-05-13 [1] CRAN (R 4.0.0)
#> callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.0)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.0)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0)
#> devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.2)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.0)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0)
#> fs 1.4.2 2020-06-30 [1] CRAN (R 4.0.2)
#> glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.0)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.2)
#> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.0)
#> knitr 1.29 2020-06-23 [1] CRAN (R 4.0.2)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.2)
#> pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 4.0.0)
#> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0)
#> processx 3.4.2 2020-02-09 [1] CRAN (R 4.0.0)
#> ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.0)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.0)
#> remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.2)
#> rlang 0.4.6 2020-05-02 [1] CRAN (R 4.0.0)
#> rmarkdown 2.3 2020-06-18 [1] CRAN (R 4.0.2)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.0)
#> usethis 1.6.1 2020-04-29 [1] CRAN (R 4.0.2)
#> withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.0)
#> xfun 0.15 2020-06-21 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0)
#>
#> [1] D:/Program Files/R/R-4.0.0/library |
You either need to call |
Sure, before I did this, I load mlr, even mlr3. but I got the error like that in the graph. Anyway, I will try the built-in "model-matrix" function. Thanks. |
In your reprex you did not and I just commented on that error. Learning to make a good reprex is a valuable skill. Often enough you find a solution yourself while trying to make one. |
Closing due to missing reprex. |
The problem is that library(mlr)
df <- data.frame(var = sample(c("A", "B", "C"), 10, replace = TRUE), stringsAsFactors=TRUE)
createDummyFeatures(df, cols = "var") |
Hi All,
I am a new learner, I prefer using mlr to do a classification task, when I use the "createDummyFeatures(df, cols = df$var)" function to generate the dummy variables, there's an error "Error in createDummyFeatures.data.frame(df, cols = df$var) :
Assertion on 'cols' failed: Must be a subset of the empty set, i.e. also empty." I tried to get a solution on the internet, but I failed again. I followed someone's solution, running "df <- data.frame(var = sample(c("A", "B", "C"), 10, replace = TRUE))", and then "createDummyFeatures(df, cols = "var")". I got the error, also, when I used my data, I got the same error. Could you please help me out ? thanks a lot!
Best,
Decen
The text was updated successfully, but these errors were encountered: