similar to: New codes() methods

Displaying 20 results from an estimated 5000 matches similar to: "New codes() methods"

1999 Aug 18
2
diag()
I would like to suggest a slight modification to diag(). In the case where x is a matrix with both row names and column names the same, it would be reasonable if the resulting vector also had those names. I often use diag() on variance matrices, where this modification is helpful. The modification requires replacing if (is.matrix(x) && nargs() == 1) return(c(x)[1 +
1999 Feb 17
1
dim enquiry
This is a minor question, but is there any difference between the two objects fred <- structure(1:10, dim = c(2,5)) and fred <- structure(1:10, .Dim = c(2,5)) Should I be using one rather than the other? Thanks, Jonathan. Jonathan Rougier Science Laboratories Department of Mathematical Sciences South Road University of Durham Durham DH1 3LE
1999 Jan 14
1
libraries
Am I right in thinking that there a discrepancy between the ?library documentation and the library() function? If I have a library called "patches", then according to the documentation (0.62.4) patches/R should contain source files like fred.R and george.R, but in practice the library only loads if both fred.R and george.R are given in a file called patches in the R subdirectory of
1999 Aug 25
2
Error in ?text (PR#256)
Just a minor point, but the adj argument in ?text is described wrongly (0.64.1). Perhaps the following might be added to the details. Values of 0, 0.5, and 1 specify left/top, middle and right/bottom, respectively. The default is for centred text, ie \code{adj = c(0.5, 0.5)}. Cheers, Jonathan. Jonathan Rougier Science Laboratories Department of
2000 Jan 04
2
set functions
I wonder if we might also include an "equiv" function along with the other set functions (ie "union", "intersect", etc), perhaps along the lines of "equiv" <- function(x, y) all(c(match(x, y, 0)>0, match(y, x, 0)>0)) (which I think might be the quickest implementation). I use this type of function quite frequently: is there some reason why it is
2000 Jan 04
2
set functions
I wonder if we might also include an "equiv" function along with the other set functions (ie "union", "intersect", etc), perhaps along the lines of "equiv" <- function(x, y) all(c(match(x, y, 0)>0, match(y, x, 0)>0)) (which I think might be the quickest implementation). I use this type of function quite frequently: is there some reason why it is
1999 Apr 30
1
legend()
In legend() is it possibly to mix lines and boxes? I would like to do something like legend(locator(1), legend = c("al", "ben", "chris", "dave"), lty = c(1, 2, 3, NA), fill = c(NA, NA, NA, "gray")) to indicate that "al", "ben" and "chris" have lines, and "dave" has a gray shading. Many thanks,
1999 Feb 10
1
Function parsing (PR#118)
Is anyone else concerned with the way in which the R function parser relocates comments that occur after condional expressions in functions to before, i.e. fred <- function(x) { # wonder what x is like if (x>0) stop("Sorry non-positive x only") # that showed x big-time! x } but then fred is parsed and stored as "fred" <- function (x) { # wonder what x is
1999 Oct 08
1
dimnames and subscripting (PR#293)
I am not sure that this is a bug, but it was unexpected -- of course my expectations are fallible, eg column ordering in model.matrix()! When an array is subscripted the names of the dimnames list are lost (v 64.1). fred <- array(1:12, 2:4, list(A = letters[1:2], B = letters[3:5], C = letters[6:9])) dimnames(fred) dimnames(fred[1, , ]) dimnames(fred[1, , , drop=FALSE]) In the first
1999 Oct 26
1
dodgy list operation (PR#298)
I can generate a segmentation fault as follows, where I would expect a syntax error: fred <- as.list(1:10) lapply(fred, "[[") platform sparc-sun-solaris2.5.1 arch sparc os solaris2.5.1 system sparc, solaris2.5.1 status status.rev 0 major 0 minor 64.1
1999 Sep 27
2
chol() dimnames
Hi Everyone, Just a minor point, but could chol() be changed to include the dimnames of the original matrix? This will ensure that x and t(R) %*% R have the same dimnames, where R <- chol(x). So we just need to insert if (!is.null(dx <- dimnames(x))) dimnames(z$v) <- dx ahead of the return. Cheers, Jonathan. Jonathan Rougier Science Laboratories
1999 Jan 20
2
dist function suggestion
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---559023410-162216788-916833047=:29339 Content-Type: TEXT/PLAIN; charset=US-ASCII On my R installation (0.62.4) there is no dist() function, so I attach one possibility. It provides
1999 Jan 22
1
backsolve... --> class()es for special matrices ?
>>>>> "JonR" == Jonathan Rougier <J.C.Rougier@durham.ac.uk> writes: JonR> ... By the way, I have `solve' JonR> methods for triangular matrices and variance matrices -- would JonR> you be interested? { Jonathan, I hope it's okay if I CC this to R-devel; this must be of a wider interest } Ye.e..s; for triangular ones,
1999 Mar 10
2
.Alias and memory
In an effort to encapsulate my dependence on class in order to deal with oldclass/class in Splus I defined the functions tfclass <- class "tfclass<-" <- function(x, value){ class(x) <- value ; x } and also the function classed <- function(x, cls) {class(x) <- cls; x} This last allows me to end a function definition with ... classed(somecalc,
1999 Mar 25
1
plot.formula and pch= (PR#149)
I'm not sure exactly where to point my finger with this one, but there is a nasty surprise to the unsuspecting user. There is no check on the length of the vector passed in the pch= argument to plot, it is just recycled as necessary: plot(1:10,1:10,pch=1:2) gives alternating circles and triangles. The nasty bits come up especially with plot.formula: x<-1:10;y<-1:10
1999 Nov 03
1
Dimnamenames (PR#257)
I've just started digging into Andreas's old report: > a <- array(0,c(2,2,2)); > dimnames(a)<-list(hansi=1:2, pepi=c("a","b"), karli=3:4) > dimnames(a[,,1]) # losing component names [[1]] [1] "1" "2" [[2]] [1] "a" "b" Now, this would be fairly easily fixed (I think) which would also make it compatible with S3.
1999 Mar 11
3
R and kron
I note that the CRAN at .at land still refers to 0.63.2. Is this just a typo? I don't want to download a whole lot only to find I still have it! Does 0.63.3 live elsewhere? And I note the new function kronecker - very useful but can it be applied to non-numerics as in factors, data frames etc preserving the class, levels and names? John
1999 Mar 11
3
R and kron
I note that the CRAN at .at land still refers to 0.63.2. Is this just a typo? I don't want to download a whole lot only to find I still have it! Does 0.63.3 live elsewhere? And I note the new function kronecker - very useful but can it be applied to non-numerics as in factors, data frames etc preserving the class, levels and names? John
1999 Dec 07
4
Finding indices with a certain property
I want the indices i for which x[i] < 0 (say): > x <- c(1, -1, 3, 3, -2) > where.negative(x) [1] 2 5 Surely where.negative is something simple, but how? G?ran -------------------------------------------------------------- G?ran Brostr?m Department of Statistics tel: +46 90 786-5223 Ume? University fax: +46 90 786-6614 S-90187 Ume?, Sweden
1999 Nov 13
1
image()
May I raise the issue of the behaviour of image()? In image() dim(z) is supposed to be c(length(x), length(y)). This suggests that the user is supplying the midpoints of the rectangles. For all but the outer rectangles this is true. The outer rectangles, however, are only displayed in half width. So it is not possible to show correctly an image plot of equally-spaced abscissa. I would hazard