Menu Home

2 replies

  1. I tried out your example on slide 9 and was having trouble. Then I realized there was a close-paren missing from the very end. It should be:
    CarData <- read.table(url('http://archive.ics.uci.edu/ml/machine-learning-databases/car/car.data&#039;), sep=',',col.names=c('buying','maintenance','doors','persons','lug_boot','safety','rating'))
    I hope that helps someone.

    On page 10, when I tried this command:
    CarData$testTrainGroup <- sample(100,size=dim(CarData)[[1]],replace=T)cTrain 20)cTest <- subset(CarData,testTrainGroup<=20)m <- glm(rating!='unacc' ~ buying + maintenance + doors + persons + lug_boot +safety, family=binomial(link = "logit"),data=cTrain)
    …I got this error:
    Error: unexpected symbol in "CarData$testTrainGroup <- sample(100,size=dim(CarData)[[1]],replace=T)cTrain"

    I'm new to R, and I don't understand what's happening in this command yet, so I'm not sure how to troubleshoot….

    Like

  2. Sorry about any typos (pasting into and out of Keynote/PDF is a problem). The second error looks like all of the line breaks are lost. R needs either line-breaks or semicolons to break up commands.

    Like

%d bloggers like this: