Errors in SIAR

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Errors in SIAR

Alex DJ
Help!

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

Previous message, but more problems:


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

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.
Reply | Threaded
Open this post in threaded view
|

Re: Errors in SIAR

Mark Difford
On Nov 11, 2011 at 1:06am Alex DJ wrote:

Alex,

I haven't followed this thread closely (now split), but this most recent request for help from you is very difficult to make sense of. I think we need access to your data set. Further, there appear to be problems with the function you are using in package siar[1], based on trying to run demos in the package. (Though this may not be the issue.)

Two things you can try are the following: First, the function you are using (siarmcmcdirichletv4) calls for matrices, not data frames (which you are using). Usually this throws an error, so maybe this is not the problem.

Secondly, if you have a factor then you turn it into an ordered factor by doing

ordered(myFactor)

where myFactor is the name of the factor you want to convert to an ordered factor. You can call the levels of your factor what you like. Here, reading up on these functions, and trying the examples, would help you to help yourself. Have you even looked at ?factor. The fact that you are new to R really means that you should be reading everything about R that you can lay your hands on. This will help you to ask sensible questions about things that still puzzle you.

And if you want to convert a factor into a numeric then you have to do something like

as.numeric(as.character(myFactor))

This is all documented in R. Have you read the manual"An Introduction to R," which comes with R? There is also plenty of good documentation on how to use R on the web and indeed on R`s homepage.

Regards, Mark.

[1] R is case-sensitive: the package is called siar, not SIAR. Please respect the author's designation.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa