I get the same error too. The documentation for the error function mse states that its argument requires a "numeric vector or list".
Running the str command to view the structure of the data frame indicates that x is an integer type.
> str(df1) 'data.frame': 10 obs. of 2 variables: $ x: int 1 2 3 4 5 6 7 8 9 10 $ y: num 0.841 0.909 0.141 -0.757 -0.959 ...
Try using as.numeric () for vector x:
library(rgp) df1 <- data.frame(x=as.numeric(1:10), y=sin(1:10)) grp.model <- symbolicRegression(y ~ x, df1, functionSet=functionSet("sin"))
weskimmo
source share