Assignment 10 error label issue

Assignment 10 error label issue

by Sierra Codeluppi -
Number of replies: 7

Good Afternoon,

I am getting the same error as the previous person who posted (i.e. Error in eval(predvars, data, env) : object 'label' not found
Calls: model.svmdt ... eval -> <Anonymous> -> model.frame.default -> eval -> eval
Execution halted).

I tried to convert the label column to a factor as noted but then I seem to get his error:

Error: At least one of the class levels is not a valid R variable name; This will cause errors when class probabilities are generated because the variables names will be converted to  X1, X2, X3 . Please use factor levels that can be used as valid R variable names  (see ?make.names for help).

I thought of just putting an X in front of the factor names but then I realized that you do not have it that way in the example.

Any suggestions on what might be going wrong?

Thank you

Sierra


In reply to Sierra Codeluppi

Re: Assignment 10 error label issue

by Erik Spence -
I'm not able to reproduce this error. Did you use the data that we processed, or the data from the original source?
In reply to Erik Spence

Re: Assignment 10 error label issue

by Sierra Codeluppi -

Hi Erik,

I’ve tried it with both cars dataset, the dataset you processed as well as the original dataset which I added columns to? Can can print the DF and see the columns are correct but still getting this error.


 

In reply to Sierra Codeluppi

Re: Assignment 10 error label issue

by Erik Spence -
I'm not sure what the issue is. Email us your code and we'll take a look.
In reply to Erik Spence

Re: Assignment 10 error label issue

by Sierra Codeluppi -
Hi Erik,

Thank you again for your help! I am getting a similar error now but only when i run KNN for the seed files because they have numbers without letters in front?

Again the error seems to be: Error: At least one of the class levels is not a valid R variable name; This will cause errors when class probabilities are generated because the variables names will be converted to X1, X2, X3 . Please use factor levels that can be used as valid R variable names (see ?make.names for help).

I have tried adding x's in front of the numbers but is that ok?

thank you again.
Sierra
In reply to Sierra Codeluppi

Re: Assignment 10 error label issue

by Erik Spence -
Be sure to use 'read.csv' as the function to read the data. Yes, the seeds file ends with ".txt", but it is a CSV file, if you look at the contents. If you don't use read.csv then you may ignore the column names, which will lead to strange behaviour.
In reply to Erik Spence

Re: Assignment 10 error label issue

by Sierra Codeluppi -

Hey Erik, 

I am currently running with read CSV only and am still getting this same error? It only occurs with factors that are also numbers in read csv. The only way I could stop this error was by using the make.names function to add a character in front of the numbers? 

In reply to Sierra Codeluppi

Re: Assignment 10 error label issue

by Erik Spence -
Again, send me your code. I'm not sure what the problem is.