Hello all,
I am following a book to learn Data Mining in R and have got stuck at this stage
I ran the following code in R Console to build a decision tree model:
library(rpart)
weatherDS <- new.env()
library(rattle)
evalq({
data <- weather
nobs <- nrow(data)
vars <- -grep('^(Date|Locat|RISK) ', names(weather))
}, weatherDS)
evalq({
set.seed(42)
train <- sample(nobs, 0.7*nobs)
}, weatherDS)
evalq({
form <- formula(RainTomorrow ~ .)
}, weatherDS)
weatherRPART <- new.env(parent=weatherDS)
evalq({
model <- rpart(formula=form, data=data[train, vars])
}, weatherRPART)
And got the following message:
Error in terms.formula(formula, data = data) :
'.' in formula and no 'data' argument
Any help would be appreciated
All the best,
Saman