Re: [R] R2WinBugs data import error

2010-12-26 Thread unsown

You solved my problem, thank you.

As you said it's the type of the content in the matrix that caused the
problem. 
I needed to put variable x along with other variables to the list, somehow
it turned out that x must be used in form of character in the statement:
dat <- list("x","otherVariables")

Anyway, my codes work well now. Thanks for your help.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R2WinBugs-data-import-error-tp3164106p3164707.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.


Re: [R] R2WinBugs data import error

2010-12-26 Thread David Winsemius


On Dec 26, 2010, at 12:44 AM, unsown wrote:



For some purpose, I  need to transfer a NAs array to WinBugs through
R2WinBugs, But I constantly got an error message:"'type' must be  
"real" for

this format". Here is my data to transfer:

x = matrix(data=NA,nrow=3,ncol=3)


str(x)
It is of mode "logical".

Try instead:
x = matrix(vector(mode="numeric",0) ,nrow=3,ncol=3)



x =  as.array(x)
data <- list ("x")


Why are you making a list with a single character element? If you need  
to pass the matricx you just created in a list then try (and don't use  
"data" as the name :


dat <- list(x)





if I add a line to above setting, then I can pass R2WinBugs:

x[1,1] = 0

If I manually input the NA array to WinBugs, I could get it running.  
So my

original data set has no problem with WinBugs.
--



David Winsemius, MD
West Hartford, CT

__
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] R2WinBugs data import error

2010-12-26 Thread unsown

For some purpose, I  need to transfer a NAs array to WinBugs through
R2WinBugs, But I constantly got an error message:"'type' must be "real" for
this format". Here is my data to transfer:

x = matrix(data=NA,nrow=3,ncol=3)
x =  as.array(x)
data <- list ("x")

if I add a line to above setting, then I can pass R2WinBugs:

x[1,1] = 0

If I manually input the NA array to WinBugs, I could get it running. So my
original data set has no problem with WinBugs.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/R2WinBugs-data-import-error-tp3164106p3164106.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.