I am using plm package with panel data and I am trying to estimate a regression with a log variable as a control variable. However, I get the following error :

Error in model.matrix.pdata.frame(data, rhs = 1, model = model, effect = effect, :

model matrix or response contains non-finite values (NA/NaN/Inf/-Inf)

The regression I'm trying to run is the following one :

plm(hrswork ~ treated + age + loghrs, data = data, model = "within",effect = "twoways") with loghrs being the log variable that is problematic.

Does anyone have a code to solve this issue ?

Thank you so much !