On 11-11-10 12:11 AM, Alex DJ wrote:
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.

data
     pond   d13C  d15N
1     A3 -2.07 6.06
2     F4 -2.39 1.3
3     K3 -2.11 1.70

tef
            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

model1<- siarmcmcdirichletv4(data, source, tef, concdep = 0,
iterations=500000, burnin=50000, howmany=50000, thinby=15, prior = rep(1,
nrow(sources)), siardata=list(SHOULDRUN=FALSE))
Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L,  :
   max not meaningful for factors*
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

source
               sources Meand13C SDd13C Meand15N SDd15N
1           2               2            2           2             2
str(data)
'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 ...
str(source)
'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.

______________________________________________
R-help@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.
______________________________________________
R-help@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.

Reply via email to