I am trying to load an equation from .txt file into an R function. The equations are very long but for sake of simplicity my test.txt file contains only a + b.
equation <- function(a,b) {
data <- read.delim("test.txt", header = F, col.names="equation", strip.white=F)
return (data$equation)
}
equation(1,1)
I have tried the code above which should give the result of 2 (1+1) but the data is loaded as factor and I cannot crack how to parse it as attributes.