[R] error:max not meaningful for factors

Jim Lemon jim at bitwrit.com.au
Fri Jul 4 11:20:50 CEST 2014


On Thu, 3 Jul 2014 12:34:42 PM Marta valdes lopez wrote:
> Thank you Jim for your answer.Ok alpha( it is the speed of the boat) is 
a
> range of number from 0.5 to 10 like 0.5,1,1.5,2...., I would like to have
> the mean of x and y base on each value of alpha, because I have like 
ten
> numbers of x for each value of speed, thats why I want the mean of 
that and
> them i could create the roc plot with the new values.
> I would say that alpha values are ordered already?
> 
> Thanks , Marta
> 
Hi Marta,
The variable "alpha" should be numeric and shouldn't cause the error 
you described. If you get this result:

is.numeric(alpha)
FALSE

then "alpha" has been converted to a factor somehow. This usually 
happens when one or more values of alpha can't be read as a number in 
the read.csv step. It doesn't seem like your dataset is very large, so 
perhaps you could print alpha:

alpha

and see if anything doesn't look like a number. You may be able to track 
this back to the CSV file and correct a typo or something.

Jim



More information about the R-help mailing list