[R] quantile() and "factors not allowed"
Steve
null at ittibitti.org
Wed Sep 29 04:20:00 CEST 2010
The underlying data contained values that resulted in Factor instead of
number fields during the read.csv. Problem fixed!
I also introduced a typo while copying the error into my message, and as
for the poor variable naming, I'll be more careful.
Thanks x3! Corrected structure:
> str(CPU)
'data.frame': 56470 obs. of 8 variables:
$ Value : num 2.91 9.10e-01 1.08e+07 3.88e+06 3.03 ...
$ Timestamp : Factor w/ 4835 levels "9/17/2010 15:30",..: 1 1 1 1 2 2 2
2 3 3 ...
$ MetricId : Factor w/ 5 levels "cpu.usage.average",..: 1 1 4 4 1 1 4
4 1 1 ...
$ Unit : Factor w/ 4 levels "%","count","KB",..: 1 1 3 3 1 1 3 3 1
1 ...
$ Entity : Factor w/ 2 levels "system1",..: 2 1 2 1 2
1 2 1 2 1 ...
$ EntityId : Factor w/ 3 levels "","EI1",..: 2 3 2 3 2
3 2 3 2 3 ...
$ IntervalSecs: int 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800
...
$ Instance : Factor w/ 1 level "": 1 1 1 1 1 1 1 1 1 1 ...
> Hi Steve,
>
> The basic problem (as the error suggests) is that data of class
> "factor" is not allowed in quantile.default. So one of the elements
> of your list must be a factor. What are the results of: str(t) ?
> As a side note, since t() is a function, using t as a variable name
> can be a bit confusing.
>
> If your list is relative small, you could post the results of dput(t)
> which would allow us to see what your data is actually like and
> perhaps identify the exact problem and offer a solution.
>
> Cheers,
>
> Josh
>
>
> On Tue, Sep 28, 2010 at 5:56 PM, Steve <null at ittibitti.org> wrote:
>> A list (t) that I'm trying to pass to quantile() is causing this error:
>>
>> Error in  quantile.default(t, probs = c(0.9, 9.95, 0.99))
>> Â factors are not allowed
>>
>> I've successfully use lists before, and am having difficulty finding my
>> mistake. Â Any suggestions appreciated!
>>
>> -Steve
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
More information about the R-help
mailing list