I don't know much about r language. So that's why I am asking your help on this, if you can.
I took a code available on internet that I tried to run.
I had a look on the forum but I still struggling.
So here below the error message:
Error in `[.data.frame`(df, row_idx, col_names) :
undefined columns selected
My hope is that by running this code, you will undestand something of R syntax, and the sort of problem that causes the error you have.
#iris is a built in example dataset all R users have
#head function prints the first few records of it
(head(iris))
#nrow tells the names of the columns in it
(names(iris))
#look at the first row
(iris[1,])
#look at the first row but on the Sepal.Length
(iris[1,"Sepal.Length"])
#look at the first row but for a column that isnt there
(iris[1,"xyz"])
#look at the all the rows for Sepal Length
(iris[,"Sepal.Length"])
#look at the all the rows but for a column that isnt there
(iris[,"xyz"])
it seems like col_names might not refer to an actual column in your data. (betting_house seems weird in the function definition), also that row_idx might not be populate with relevant values.