undefined column selected error

Error in [.data.frame(data, , model.list$variables) :
undefined columns selected

has anyone has this issue??? me and a classmate cannot figure out what/where the errors are. We even went as far as taking out dummy variables and placing them back in again (among also looking at everything line-by-line)

what does


show ?

please provide your answer as text , formatted as code; rather than a screenshot.

undefined columns selected

[1] "as.factor(left_company_Yes)"
[2] "business_travel_None"
[3] "business_travel_Rarely"
[4] "department_IT and Analytics"
[5] "department_Marketing"
[6] "department_Product Development"
[7] "department_Research"
[8] "department_Sales"
[9] "job_level_Director"
[10] "job_level_Manager"
[11] "job_level_Senior Manager"
[12] "job_level_Vice President"
[13] "job_satisfaction_Low"
[14] "job_satisfaction_Medium"
[15] "job_satisfaction_Very High"
[16] "left_company_Yes"
[17] "marital_status_Married"
[18] "marital_status_Single"
[19] "miles_from_home"
[20] "performance_rating_Exceptional"
[21] "performance_rating_Meets Expectations"
[22] "performance_rating_Minimally Effective"
[23] "performance_rating_Not Effective"
[24] "previous_companies"
[25] "salary"
[26] "weekly_hours"
[27] "yrs_at_company"
[28] "yrs_since_promotion" Preformatted text

the neuralnet function you chose to use wants the variables in the data.frames you give it to have syntactically valid names for R :

A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. Names such as ".2way" are not valid, and neither are the reserved words.

in the following I demonstrate how neuralnet can be flumoxed by poisoning a variable name.
While you can use normal methods to rename variables manually and fix in a targetted way; I also show an example of using make.names() which is a function that tries to reconstruct names to be valid


# Binary classification
nn <- neuralnet(Species == "setosa" ~.,
                linear.output = FALSE)

badiris <- iris
names(badiris)[[1]] <- "fdgf 4tt ! ( .) "
nn <- neuralnet(Species == "setosa" ~ .,
                linear.output = FALSE)

betteriris <- badiris 
names(betteriris) <- make.names(names(badiris))

nn <- neuralnet(Species == "setosa" ~ .,
                linear.output = FALSE)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.