Skip to content
Open
2 changes: 1 addition & 1 deletion R/convertDiscrete.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ discreteValueToName = function(par, x) {
if (par$type == "discrete") {
ns[getIndex(par$values, x)]
} else if (par$type == "discretevector") {
sapply(x, function(x) ns[getIndex(x, values = par$values)])
vcapply(x, function(app x) ns[getIndex(x, values = par$values)])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nice thing about sapply is that it gives list() in case of length(x) == 0, which would match quite nicely with the actual default being list(). When the related BBmisc issue gets fixed, this will result in the most natural printout. vcapply will give character(0) when x is list(), which is a deviation from the behaviour of the other "vector" types (which always show logical(0), numeric(0) etc. depending on their type).

Not going to say much about the syntax error here.

Copy link
Member

@jakob-r jakob-r Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the typo. But in the documentation we say that the output is a character vector.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I didn't consider the other points from which discreteValueToName gets called. I'd still say the printout of a discreteVectorLearnerParam with default list() shouldn't have character(0) in it.

}
}