[R] Odp: Error in matrix, not ordered vectors or numerical value, and SIAR.

Petr PIKAL petr.pikal at precheza.cz
Fri Nov 11 13:00:05 CET 2011


> 
> Re: [R] Odp:  Error in matrix, not ordered vectors or numerical value, 
and SIAR.
> 
> Thank-you Petr. 
> 
> I have consulted as many manuals and help pages, and search engines, and
> trying various things in SIAR, but continuous errors prevail.. 
> 
> I have tried changing all matrices to numeric, but the first column , of 
the
> two latter matrices, returns as NA. Any other suggestions? 
> 
> I had put in one of these messages more detail about data, see below. 
> 
> 
> pond <- c("A3", "A3", "A3", "B3", "B3", "B3","C2", "A7", "A7")
> d13C <- c(-22.07, -20.39, -21.11...) 
> d15N <- c(16.06, 17.13, 16.7, ...)
> FConsumerData <- data.frame(pond, d13C, d15N)
> FTEFData <- data.frame(tefsources, tefMeand13C, tefSDd13C, tefMeand15N,
> tefSDd15N)
> sources <- c("Copepoda", "Algal Paste", "Amphipoda",
> Meand13C <- c(-26.57, -20.41, -21.65,...
> SDd13C <- c(1.78, 4.01, 1.46,...
> Meand15N <- c(15.55, 9.58, 14.07...
> SDd15N <- c(1.77, 1.34, 1.66,...
> FSourceData <- data.frame(sources, Meand13C, SDd13C, Meand15N, SDd15N)
> tefsources <- c("Copepoda", "Algal Paste", "Amphipoda",...
> tefMeand13C <- c(0.4, 0.4, 0.4,...
> tefSDd13C <- c(1.3, 1.3, 1.3,
> tefMeand15N <- c(3.4, 3.4, 3.4, 
> tefSDd15N <- c(1.0, 1.0, 1.0, 
> 
> Hope that helps explain? 

Not much. 

FConsumerData is data frame with nonnumeric first column, the same is with 
FTEFData and FSourceData. If you change it to matrix you will get 
character matrix. Trying to change character values to numeric obviously 
leads to NA. How the poor R shall know what number it shall make from A3, 
B3, C2 or A7?

I do not use siar package but in the help page it is clearly stated that 
input shall be ***numeric*** matrices. Not data frames, not character 
values not factors. If you do not know distinction among those objects you 
shall look into R intro document (at least first 6 chapters) which should 
came along with your installation.

BTW, in help page there is

out <- 
siarmcmcdirichletv4(geese1demo,sourcesdemo,correctionsdemo,concdepdemo)

It does not produce any error does it?

If it does not produce any error it is sign that something is wrong with 
your data. Look at structure of your objects you are trying to evaluate 
and compare it with those demo objects.

str(object)

is the first option when something does not seem to be OK.

Regards
Petr




> 
> ?? 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-in-
> 
matrix-not-ordered-vectors-or-numerical-value-and-SIAR-tp4024578p4030650.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.



More information about the R-help mailing list