The png shows how my .csv data frame.

THE WHOLE CODE I USE IS THIS ONE:

getwd()

setwd("C:/Users/Lucas M/Desktop")

Billy =read.csv("Billy.csv")

attach(Billy)

head(Billy)

names(Billy)<- c ("Village", "Time.resident.(yrs)", "Distance.to.pa.(km)", "Full.perimeter.fence", "Perimeter.ht.(m)", "Corral.distance.(m)", "Corral.ht.(m)", "Corral.area.(m²)", "Corral.strength.(1-5)", "Wooden.poles", "Metal.poles", "Horizontal.poles", "Metal.wiring", "Brash", "Cattle.lion.corral.attacks" )

sapply(Billy,class)

head(Billy)

Billy<- transform(Billy, Village= as.factor(Village))

sapply(Billy,class)

Billy<- transform(Billy, Full.perimeter.fence= as.factor(Full.perimeter.fence))

Billy<- transform(Billy, Wooden.poles= as.factor(Wooden.poles))

Billy<- transform(Billy, Metal.poles= as.factor(Metal.poles))

Billy<- transform(Billy, Horizontal.poles= as.factor(Horizontal.poles))

Billy<- transform(Billy, Metal.wiring= as.factor(Metal.wiring))

Billy<- transform(Billy, Brash= as.factor(Brash))

Billy<- transform(Billy, Cattle.lion.corral.attacks= as.factor(Cattle.lion.corral.attacks))

Billy<- transform(Billy, Time.resident..yrs.= as.numeric(Time.resident..yrs.))

sapply(Billy,class)

summary(Billy)

sample <- sample.split(data$num, SplitRatio = 0.65

train <- subset(data, sample == TRUE)

test <- subset(data, sample == FALSE)

THE PROBLEM IS ON RUNNING THIS CODE

sample <- sample.split(data$num, SplitRatio = 0.65

train <- subset(data, sample == TRUE)

test <- subset(data, sample == FALSE)

THE ERROR IS THIS

sample <- sample.split(data$num, SplitRatio = 0.65

- train <- subset(data, sample == TRUE)

Error: unexpected symbol in:

"sample <- sample.split(data$num, SplitRatio = 0.65

train"

test <- subset(data, sample == FALSE)

Error in sample == FALSE :

comparison (1) is possible only for atomic and list types