There are a couple of ways to get this error, but I think the issue here is you are regressing over a character vector. Gender
is characters "Male" or "Female".
You want to convert that into a numerical variable, 1 or 0 for one gender.
Here's a reprex for that kind of error (and for future reference you'll want to pose questions about coding errors like this with a reprex)
library(dplyr)
df <- tibble(
y = LETTERS[1:3],
x1 = 1:3,
x2 = 3:5
)
lm(y ~ x1 + x2, data = df)
#> Warning in storage.mode(v) <- "double": NAs introduced by coercion
#> Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...):
#> NA/NaN/Inf in 'y'
Created on 2022-03-26 by the reprex package (v2.0.1)
Do be careful about how you interpret your results! I don't think weight, height or games will do anything to correctly predict or explain one's gender.