[R] Fehler in x$terms : $ operator is invalid for atomic vectors

Boriss at gmx.net Boriss at gmx.net
Sat Oct 18 21:04:14 CEST 2008


Dear All

I try to use your R package MCMCpack and I have encountered the following problem:

 

The following code works fine:

 

library(MCMCpack)

line <- list(X = c(-2,-1,0,1,2), Y = c(1,3,3,3,5))

posterior1 <- MCMCregress(X~Y, data=line)  

summary(posterior1)  

 

But as long as I try the following lines

 

library(MCMCpack)

line <- list(X = c(-2,-1,0,1,2), Y = c(1,3,3,3,5))

posterior2 <- MCMCregress(paste(“X”,”Y”,sep=”~”), data = line)  

summary(posterior2)  

 

I get the following error message:

 

>   library(MCMCpack)

> line <- list(X = c(-2,-1,0,1,2), Y = c(1,3,3,3,5))

> posterior2 <- MCMCregress(paste("X","Y",sep="~"), data = line)

Fehler in x$terms : $ operator is invalid for atomic vectors

> summary(posterior2)

Fehler in summary(posterior2) : objekt "posterior" nicht gefunden

> 

  

 

This is seems to me a bit strange as the following line with the command lm(), which I believe use a similar structure, works fine:

 

  X = c(-2,-1,0,1,2)

  Y = c(1,3,3,3,5)

  lm(paste("X","Y", sep="~"))

  lm(X~Y)

 

Thank you

Borissssssssssssssssssssss


--



More information about the R-help mailing list