Date: Tue, 14 May 1996 16:23:37 -0400 From: pgilbert@bank-banque-canada.ca (Paul Gilbert) To: R-testers@stat.math.ethz.ch Subject: R-alpha: R 0.5 Message-Id: <96May14.161051edt.29443@mailgate.bank-banque-canada.ca> The compile and installed of R 0.5 under Solaris went very smoothly. I'm using X11R6 so there don't seem to be graphics problems. I source()d lots of code (about 17000 line) and there don't seem to be any more syntax differences between R and S left in my code. But when I start running things there are some problems. Using functions appended below I get the following error which I cannot seem to isolate. Also, if I put browser() or cat() into the function "tframe<-.default" they seem to have no affect. > tspvector <- ts(1:100, start=c(1981,3), frequency=4) > data <- matrix(rnorm(300),100,3) > tframe(data) <- tframe(tspvector) Error in tframe<-(c(-2.134976, 0.7320667, -0.9144324, 0.6790059, 1.806068, -0.9620563, : unused argument to function > Also, noted in passing, though I haven't yet assessed the importance: print.default() has slightly different arguments than the S version. ts() assigns a class of "tsp" to objects, which is logical but different. The danger is that the object may have another class which it looses. (The tframe code which gives me the error above is intended, among other things, to avoid this problem.) I tend to think of S/R functions as verbs so there is no problem with license() returning the licence, even in the provinces. (Of course, licence would be more correct en provence, unless you worry also about what it means instead of just how it's spelled.) Paul Gilbert ___________ tframe <-function(x)UseMethod("tframe", x) tframe.default <-function(x) {#extract the tframe if (is.tframed(x)) tf <- attr(x, "tframe") else {if (is.ts(x)) tf <- tsp(x) else {if (is.matrix(x)) tf <-c(1, dim(x)[1], 1) else tf <- c(1, length(x), 1) } class(tf) <- c("tsp", "tframe") } tf } "tframe<-" <-function(x, tf) UseMethod("tframe<-", x, tf) "tframe<-.default" <-function(x,tf) {# check if tf is consistent with x and then assign the tframe attr # tf should have a main class of "tframe" if(is.null(tf)) {attr(x, "tframe") <- NULL return(x) } if (!is.tframe(tf)) {if( is.null(tf$start) & is.null(tf$end) ) stop("tf must be of class tframe or a list of arguments for ts().") attr(x, "tframe") <- NULL # in case this is reassignment of a tframed x tf <- tframe(do.call("ts", append(list(rep(NA,periods(x))),tf))) } if (!is.consistent.tframe(tf,x)) stop("time frame in tframe assignment is not consistent with data.") attr(x, "tframe") <- tf # clean out other possibly contradictory time info: tsp(x) <-NULL if (inherits(x,"rts") | inherits(x,"cts") | inherits(x,"its")) class(x) <- NULL attr(x, "tspar") <- NULL if (!is.null(dimnames(x))) {nm <- vector("list", length(dimnames(x))) nm[[2]] <- dimnames(x)[[2]] dimnames(x) <- nm } x } is.tframed <-function(x) inherits(attr(x, "tframe"), "tframe") =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-testers mailing list -- To (un)subscribe, send subscribe or unsubscribe (in the "body", not the subject !) To: r-testers-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-