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
library(neuralnet)
# Binary classification
nn <- neuralnet(Species == "setosa" ~.,
iris,
linear.output = FALSE)
badiris <- iris
names(badiris)[[1]] <- "fdgf 4tt ! ( .) "
nn <- neuralnet(Species == "setosa" ~ .,
badiris,
linear.output = FALSE)
betteriris <- badiris
names(betteriris) <- make.names(names(badiris))
nn <- neuralnet(Species == "setosa" ~ .,
betteriris,
linear.output = FALSE)