Skip to content

Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, : max not meaningful for factors

7 messages · Duncan Murdoch, Alex DJ, David Winsemius +1 more

#
Hello, 

Beginner, sorry if this is wasting anyone's time, but have been working on
this for a couple of days now, think it should have take a few hours! 

The Problem:

Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L,  : 
  max not meaningful for factors

I have tried to re-arrange and check formula. I am working in SIAR, and
cannot get model1 to run because of the error code below. Is this because of
the first column being names? How do I rename the columns and to what? 

Below is the code and data frames with some omissions of values. In the
middle is the model I am trying to run, which returns with the error code
above.
pond   d13C  d15N
1     A3 -2.07 6.06
2     F4 -2.39 1.3
3     K3 -2.11 1.70
tefsources tefMeand13C tefSDd13C tefMeand15N tefSDd15N
1            Copepoda         0.4       1.3         3.4      0.99
2         Algal Paste         0.4       1.3         3.4      0.99
3           Amphipoda         0.4       1.3         3.4      0.99
Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L,  : 
  max not meaningful for factors*
sources Meand13C SDd13C Meand15N SDd15N
1           2               2            2           2             2
'data.frame':	101 obs. of  3 variables:
 $ pond: Factor w/ 6 levels "A3","A5","A7",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ d13C: num  -22.1 -20.4 ...
 $ d15N: num  16.1 17.1 ...
'data.frame':	18 obs. of  5 variables:
 $ sources : Factor w/ 18 levels "Algal Paste",..: 8 1 2 3 4 5 7 9 10 6 ...
 $ Meand13C: num  -26.6 -20.4 ...
 $ SDd13C  : num  1.78 4.01 1.46 ...
 $ Meand15N: num  15.55 9.58 14.07 
 $ SDd15N  : num  1.77 1.34 1.66 
'data.frame':	18 obs. of  5 variables:
 $ tefsources : Factor w/ 18 levels "Algal Paste",..: 8 1 2 3 4 5 7 9 10 6
...
 $ tefMeand13C: num  0.4 0.4 ...
 $ tefSDd13C  : num  1.3 1.3  ...
 $ tefMeand15N: num  3.4 3.4 ...
 $ tefSDd15N  : num  0.99 0.99  ...

It looks like a problem with the pond column of the first data frame
(data).. 

I am still trying to fix this but need some outside help! Many thanks. 

Alex. 




--
View this message in context: http://r.789695.n4.nabble.com/Error-in-Summary-factor-c-1L-1L-1L-1L-1L-1L-1L-1L-1L-1L-4L-max-not-meaningful-for-factors-tp4022502p4022502.html
Sent from the R help mailing list archive at Nabble.com.
#
On 11-11-10 12:11 AM, Alex DJ wrote:
The problem appears to be in the siarmcmcdirichletv4 function.  Is that 
yours, or from a package?  In any case, it looks as though it is trying 
to take a max of an unordered factor.  For example, I get the error using

 > f <- factor(letters[1:5])
 > f
[1] a b c d e
Levels: a b c d e
 > max(f)
Error in Summary.factor(1:5, na.rm = FALSE) :
   max not meaningful for factors

If the factor has ordered levels, then use ordered() to create it.  For 
example,

 > fo <- ordered(f)
 > fo
[1] a b c d e
Levels: a < b < c < d < e
 > max(fo)
[1] e
Levels: a < b < c < d < e

Duncan Murdoch
#
Thanks Duncan. 

This is a package, SIAR.
> fo 
[1] a b c d e 
Levels: a < b < c < d < e 
 > max(fo) 
[1] e 
Levels: a < b < c < d < e 

The data set has 101 values, what can I use instead of letters? 


Best wishes, 

Alex. 

--
View this message in context: http://r.789695.n4.nabble.com/Error-in-Summary-factor-c-1L-1L-1L-1L-1L-1L-1L-1L-1L-1L-4L-max-not-meaningful-for-factors-tp4022502p4023231.html
Sent from the R help mailing list archive at Nabble.com.
#
On Nov 10, 2011, at 6:12 AM, Alex DJ wrote:

            
Why not as.numeric(fo)?
#
Hi
Why do you need to use letters? AFAIK this was only illustration what 
could be root of the error message. If the function requires ordered 
factor you can use

your.ordered.factor <- ordered(your.unordered.factor)

I do not remember original mail but to get rid of error message, the 
function probably needs as an input ordered factor or numeric values. You 
shall consult help page for this function which option is valid.

Regards
Petr
Summary-factor-c-1L-1L-1L-1L-1L-1L-1L-1L-1L-1L-4L-max-not-meaningful-for-
http://www.R-project.org/posting-guide.html
#
When you put (fo) what do you mean? 

With ordered variable am now getting this error message: 

model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 500000, 50000)
Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow =
(siardata$iterations -  : 
  invalid 'ncol' value (too large or NA)
In addition: Warning message:
In Ops.ordered((numsources + numiso), numgroups) :
  '*' is not meaningful for ordered factors

Should I now change to numeric? How do I do this (example code if possible
please, am beginner and struggling!)? 

Thanks again for your help. 

Alex. 

--
View this message in context: http://r.789695.n4.nabble.com/Error-in-Summary-factor-c-1L-1L-1L-1L-1L-1L-1L-1L-1L-1L-4L-max-not-meaningful-for-factors-tp4022502p4024505.html
Sent from the R help mailing list archive at Nabble.com.
#
Why do you need to use letters? AFAIK this was only illustration what 
could be root of the error message. If the function requires ordered 
factor you can use 

your.ordered.factor <- ordered(your.unordered.factor) 

I do not remember original mail but to get rid of error message, the 
function probably needs as an input ordered factor or numeric values. You 
shall consult help page for this function which option is valid. 

as.numeric comes back as NA for the pond dataset (A3, A5, A7, B3, B7, C2)

Cannot use ordered factor as * function does not work for this. ? And is
needed to run the model (see below). 

ANYONE know max length for dataset in SIAR? 

NOW getting following error: 

model1 <- siarmcmcdirichletv4(data, source, tef, concdep=0, 500000, 50000)
Error in matrix(1, ncol = (numsources + numiso) * numgroups, nrow =
(siardata$iterations -  : 
  invalid 'ncol' value (too large or NA)
In addition: Warning message:
In Ops.ordered((numsources + numiso), numgroups) :
  '*' is not meaningful for ordered factors

Matrix 1 has only 6 vectors in column 1. 


Thank-you. 

Alex. 

--
View this message in context: http://r.789695.n4.nabble.com/Error-in-Summary-factor-c-1L-1L-1L-1L-1L-1L-1L-1L-1L-1L-4L-max-not-meaningful-for-factors-tp4022502p4024542.html
Sent from the R help mailing list archive at Nabble.com.