This fairly harmless looking piece of code, which worked in
0.61 (and in S-PLUS) fails in 0.62.1.
R> "mcpar<-" <- function(x,mcpar) {attr(x,"mcpar")
<- mcpar; x}
R> mcpar(x) <- c(1,100,1)
Error in mcpar<-(*tmp*, value = c(1, 100, 1)) : unused argument to function
The error message gives a hint about how to work around the problem -
just replace the argument "mcpar" with "value".
R> "mcpar<-" <- function(x,value) {attr(x,"mcpar")
<- value; x}
R> mcpar(x) <- c(1,100,1)
R>
This breaks release 0.3-3 of my "coda" package, but I will fix it.
Martyn
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Martyn Plummer <plummer@iarc.fr> writes:> > This fairly harmless looking piece of code, which worked in > 0.61 (and in S-PLUS) fails in 0.62.1. > > R> "mcpar<-" <- function(x,mcpar) {attr(x,"mcpar") <- mcpar; x} > R> mcpar(x) <- c(1,100,1) > Error in mcpar<-(*tmp*, value = c(1, 100, 1)) : unused argument to function > > The error message gives a hint about how to work around the problem - > just replace the argument "mcpar" with "value". > > R> "mcpar<-" <- function(x,value) {attr(x,"mcpar") <- value; x} > R> mcpar(x) <- c(1,100,1) > R> > > This breaks release 0.3-3 of my "coda" package, but I will fix it. > MartynHmm. We had some pretty antisocial consequences from *not* using the value= form with John Chambers' [<-.data.frame code, which assumes that it is used that way in order to see whether i,j, or both are absent. So Splus is using value= on indexing operations only? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
I'm having the same problem without a clue to a work around. (Mind you, the
work
around for mcpar wasn't so obvious to me.)
Paul Gilbert
____
R : Copyright 1998, The R Development Core Team
Version 0.62.1 (June 15, 1998)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "?license" or "?licence" for distribution details.
R is a collaborative project with many contributors.
Type "?contributors" for a list.
Type "demo()" for some demos, "help()" for on-line help,
or
"help.start()" for a HTML browser interface to help.
> search()
[1] ".GlobalEnv" "Autoloads"
"package:base"> "tframe<-" <-function(x, tf)
{
attr(x, "tframe") <- tf
x
}
+ + + + > >> x <- 1:10
> tframe(x) <- c(1,1000,1)
Error in tframe<-(*tmp*, value = c(1, 1000, 1)) : unused argument to
function>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
The light came on. I was thinking the problem with mcpar was that the argument had the same name as the function, but it is that the argument must be called "value". If R is intended to be like this it seems like a pretty serious incompatibility with S (not to mention that I will have to make a lot of changes). Paul Gilbert -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._