mlr-archive / mlr-tutorial

The mlr package online tutorial
http://mlr-org.github.io/mlr/
20 stars 11 forks source link

Can't build tutorial locally. Possible typo in code? #133

Closed AlexEngelhardt closed 6 years ago

AlexEngelhardt commented 6 years ago

When going ./build, I get this error:

Knitting file 'benchmark_experiments.Rmd' ...
Quitting from lines 523-529 () 
Error: Faceting variables must have at least one value
Execution halted

It refers to this code in benchmark_experiments.Rmd:

## Density plots for two tasks
qplot(mmce, colour = learner.id, facets = . ~ task.id,
  data = perf[perf$task.id %in% c("iris_example", "Sonar_example"),], geom = "density") +
  theme(strip.text.x = element_text(size = 8))

When I look into perf, the task id of sonar.task is "Sonar-example" (with a hyphen), but here you subset for "Sonar_example" (with an underscore). Is that a typo? I'm not sure, since if yes, no one should be able to build it currently, right?

Note: "Sonar_example" instead of "Sonar-example" appears again in line 557, throwing an error for me.

AlexEngelhardt commented 6 years ago

Oops, nevermind, got it: #132

I had to install the development version of R.

pat-s commented 6 years ago

I had to install the development version of R.

Why?

Updating mlr to the latest commit should have solved the problem as the problematic code depends on mlr being ahead of the commit that introduced #132.

AlexEngelhardt commented 6 years ago

Because I don't use the git-cloned version of mlr to run in R, I just library(mlr), i.e. I had to re-do install_github(mlr...).

Is there a smarter way I'm missing?

pat-s commented 6 years ago

If you do development, you should always use the development version. Whether you use a git-repo locally (do you this by "smarter way"?) or install the git version via ( "install_github") is not important at the first place but having a local git repo makes it easier to debug/make small changes. So because mlr-tutorial depends on mlr code-wise, this means that it would be advisable to have the development versions of both installed.

I was irritated by your comment "I had to install the development version of R.". I guess you meant "[,,,] to install the development version of mlr?

AlexEngelhardt commented 6 years ago

Oh! Yes, of course, mlr, sorry :D

So is it possible to load the git repo when I go library(mlr), without having to install_github() at all? If so, is that documented somewhere?

jakob-r commented 6 years ago

If you call library(mlr) the last installed version of mlr will be loaded this can be the cran, github or whatever version. This totally depends of what mlr version you installed the last time. So you don't have to install_github() every time.

AlexEngelhardt commented 6 years ago

But when I install from the github directory (let's say ~/github/mlr), I'd do that via devtools::install("~/github/mlr/"), right?

Then, every time I pull the newest updates, I'd still have to re-issue devtools::install("~/github/mlr/") again?

That's my main question. Do I have to re-install after every pull, or can I tell R somehow to just load the package by sourcing all files in ~/github/mlr/R?

pat-s commented 6 years ago

Then, every time I pull the newest updates, I'd still have to re-issue devtools::install("~/github/mlr/") again?

No, after you have pulled the latest commits into your local repo, you can simply do a local installation, e.g. R CMD INSTALL. devtools::install("~/github/mlr/") automatically downloads the latest git source but does not pull it into your local repo, it just installs it on your system.

Do I have to re-install after every pull,

Yes, you do, either by doing a local install with the pulled files or by using devtools::install_github() which does the download and installation in one step but does not provide you with the most recent commits for your local repo.

However, I think this is off-topic now here :smile: