commit ba413b4479c4faef9c3f1366a1cd98f2e2bee6fc
parent 4eff300b6b36608e58a964fa9ee048c3d28a43d7
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date: Mon, 9 May 2022 12:05:57 -0400
Handling booleans better
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/scale_and_apply.Rmd b/scale_and_apply.Rmd
@@ -37,6 +37,8 @@ Define `find_norm` and run it on our "training data"
```{r find_norm}
find_norm <- function(dat) {
center_and_scale <- function(x) {
+ if (is.logical(x))
+ x <- as.numeric(x)
if (is.numeric(x)) {
x_mean <- mean(x, na.rm = TRUE)
if (min(x) >= 0 && max(x) <= 1)