Displaying 20 results from an estimated 6000 matches similar to: "gamma() function for complex arguments"
2004 Nov 18
0
Fwd: Re: 3d scatter plot with drop line
Hi
try this:
p3dpairs <- function(x,x1,
xlim=NULL,ylim=NULL,zlim=NULL,col=par("col"), pch=par("pch"),
cex=par("cex"), ...){
if(is.matrix(x)){
z <- x[,3]
y <- x[,2]
x <- x[,1]
}
if(is.matrix(x1)){
z1 <- x1[,3]
y1 <- x1[,2]
x1 <- x1[,1]
}
if(missing(zlim)) {
z.grid <-
2004 Jul 05
1
"make" error for R-1.9.1
Hello everybody.
I am trying to upgrade from R-1.9.0 to R-1.9.1 on a RedHat linux
2.4.18 system. I get
the following error after "tar -xvzf R-1.9.1.tgz ; cd ./R-1.9.1/ ; ./configure"
and "make" :
[make works for 10 minutes ... snip ...]
varExp text html latex
varFixed text html latex
varFunc
2004 Sep 13
1
Rd files with "%" (was: permuting dimensions)
Professor Ripley
thanks for this. Very much appreciated.
The original subject line reflected my late-night conviction
that the answer might involve passing a strange list to do.call().
Anyway, package magic is broken (only in R-devel, I might add) because I have
a function called "%eq%".
R-2.0.0 CMD check is stopping (I think) because it interprets the
"%" as a
2004 Sep 08
3
do.call("[", ...) question
Hi again everyone
I have an arbitrarily dimensional array "a" and a list "jj" of length
length(dim(a)). The elements of jj are vectors of indexes.
How do I use do.call() to extract a[ jj[[1]], jj[[2]], jj[[3]], ...] ?
Toy example follows:
a <- matrix(1:30,5,6)
jj <- list(5:1,6:1)
I want the following
a[ jj[[1]],jj[[2]] ]
How do I do this?
OBAttempts:
2004 Jun 11
4
rownames of single row matrices
Hi
I want to extract rows of a matrix, and preserve rownames even if only
one row is selected. Toy example:
R> a <- matrix(1:9,3,3)
R> rownames(a) <- letters[1:3]
R> colnames(a) <- LETTERS[1:3]
R> a
A B C
a 1 4 7
b 2 5 8
c 3 6 9
Extract the first two rows:
R> wanted <- 1:2
R> a[wanted,]
A B C
a 1 4 7
b 2 5 8
rownames come through fine. Now extract just
2004 Nov 15
2
argument rationalization
Hi
I am writing a bunch of functions that take two, three or four
arguments. These functions operate on vectors of the same length;
but I want the function
to behave sensibly if one or more arguments are scalars. "+" does
this for two arguments:
"+"(1:10,3) # interpreted as "+"(1:10,rep(3,10))
But my functions can take more arguments. Say f() takes three:
2004 Mar 12
1
another do.call() problem.
Hi everyone
suppose I have
a <- array(1:256,rep(4,4))
and want to access a[1,2,3,1] by the vector c(1,2,3,1). As per
yesterday, I can use do.call():
a[1,2,3,1] == do.call("[",c(list(a),c(1,2,3,1)))
Now how do I apply the above technique (or indeed any other technique!) to get
a[1,2,3,]
[1] 37 101 165 229
from a vector like c(1,2,3,0) or c(1,2,3,NULL) or c(1,2,3,NA)?
2004 Jan 14
1
arrows on contour lines
Hello everybody
I'm using contour() to draw streamlines of potential flow, eg
jj <- seq(from= -4, to=4,len=20)
jj <- outer(jj,jj,function(x,y){x})+1i*outer(jj,jj,function(x,y){y})
f <- function(x){x^2}
contour(Im(f(jj)), nlevels=44 , labels="")
How best to put arrows on the contour lines to show the direction of flow?
(ie I want contour lines looking like
2004 Nov 11
1
axis lines crossing at origin
Hi
how do I make my axes cross at the origin?
x <- seq(from=-pi,to=pi,len=30)
plot(x,sin(x))
makes the axes cross at about (-pi,-1).
How do I get my x and y axes to cross in the centre of the graph,
with the sine curve passing through
the intersection?
I couldn't find anything in ?par or ?axis; searching R-FAQ for "axis"
didn't help.
--
Robin Hankin
Uncertainty
2004 May 25
2
vectorize an expression
Hi guys. Another thing I cannot vectorize:
I have an array "a", of size 5-by-2, for example, of 5 2D vectors. I
also have a distance function that computes the distance between two
vectors (usual Euclidean distance is a good example but I have other metrics I
want to use as well). I want a 5-by-5 array with the [i,j]th element being
the distance from a[i,] to a[j,]
To Wit:
a
2004 Oct 18
2
concatenating lists elementwise
Hi
How do I concatenate two lists element-by-element?
Example:
list.1 <- list(temperature=c("hot","cold") , size=c("big","medium"))
list.2 <- list(temperature=c("lukewarm") , size=c("massive","tiny"))
list.wanted <- list(temperature=c("hot","cold","lukewarm") ,
2004 Mar 10
3
aperm() and as.list() args to "["
Hi everyone.
I'm playing with aperm():
a <- 1:24
dim(a) <- c(2,3,2,2)
permutation <- c(1,2,4,3)
b <- aperm(a,permutation)
So if my understanding is right,
a[1,3,2,1] == b[c(1,3,2,1)[permutation] ]
but this isn't what I want because the RHS evaluates to a vector, and
I am trying to identify a single element of b.
How do I modify the RHS to give what I want?
Following
2004 May 27
2
block diagonal matrix function
Hello List
I have just written a little function that takes two matrices as
arguments and returns a large matrix that is composed of the two input
matrices in upper-left position and lower-right position with a padding
value everywhere else. (function definition and toy example below). I
need nonsquare matrices and rowname() and colname() inherited appropriately.
Two questions:
(1) Is there a
2003 Nov 26
0
new R package: magic squares
Dear List
I have just placed a new R package on CRAN that includes many tools
for creating and
investigating magic squares and hypercubes.
Any comments, suggestions, etc very welcome. I am particularly interested in
coding up additional algorithms for magic squares, and also in improving the
existing methods.
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
SO14 3ZH
tel
2004 May 28
1
optim(method="SANN")
Hello List
I'm working on a combinatoric problem in which the object is to
minimize the badness() of a vector. I think this class of problem is only
soluble by optim() using method=SANN.
The badness() of anything is >= 0, and when I've found a solution with
zero badness, I want optim() to stop (carrying on beyond zero badness
cannot improve the solution). Efficiency is crucial here.
2004 Jul 27
1
library manual: documentation of funcs not alphabetically ordered
Hello everybody
I'm putting finishing touches to a library, and have noticed that the
.dvi file that R CMD check
creates does not sort the functions in alphabetical order.
I find this odd because I used the "tidy" routines in section 3.1 of
the R-exts manual, which produce R code in which the functions are
alphabetically ordered (and I performed R CMD check using the
2004 Sep 07
2
noncommutative addition: NA+NaN != NaN+NA
Hi guys.
Check this out:
> NaN +NA
[1] NaN
> NA + NaN
[1] NA
I thought "+" was commutative by definition. What's going on?
> R.version
_
platform powerpc-apple-darwin6.8
arch powerpc
os darwin6.8
system powerpc, darwin6.8
status
major 1
minor 9.0
year 2004
month 04
day 12
language R
>
(Both give NA under linux, so it looks
2004 Nov 08
1
conv() example in R-exts
Hi
[I'm not sure if this is "intelligible to non-programmers" or not]
R-exts (section 4.2) gives an example of the .C() function whose
third argument is
"as.integer(length(a))",
and urges the user to coerce all the arguments to the correct form
(on pain of "hard-to-catch errors"
which I now know to be very appropriate, if understated, phrasing).
The
2004 Nov 19
0
new package gsl, a wrapper for the Gnu Scientific Library
Dear list
R package "gsl" is now on CRAN. This is a wrapper for
the special functions of the Gnu Scientific Library (GSL). Functions include
elliptic integrals, Airy functions, hypergeometric functions, and so on.
Most functions optionally return error estimates.
This library is a little odd in that documentation is limited to a
pointer to the GSL reference
manual, and occasional
2004 Nov 19
0
new package gsl, a wrapper for the Gnu Scientific Library
Dear list
R package "gsl" is now on CRAN. This is a wrapper for
the special functions of the Gnu Scientific Library (GSL). Functions include
elliptic integrals, Airy functions, hypergeometric functions, and so on.
Most functions optionally return error estimates.
This library is a little odd in that documentation is limited to a
pointer to the GSL reference
manual, and occasional