.
URL http://www.jstatsoft.org/v46/i08/
best wishes
Robin
--
Robin Hankin
Uncertainty Analyst
hankin.ro...@gmail.com
___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages
of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
--
Robin Hankin
Uncertainty Analyst
hankin.ro...@gmail.com
Hello
convex hulls in large numbers of dimensions are hard.
For your problem, though, one can tell whether a given
point is inside or outside by using linear programming:
X - matrix(rnorm(50), 10, 5)
x_i - matrix(rnorm(5), 1, 5)
isin.chull
function(candidate,p,plot=FALSE,give.answers=FALSE,
pm, Robin Hankin rk...@cam.ac.uk wrote:
Hello
convex hulls in large numbers of dimensions are hard.
For your problem, though, one can tell whether a given
point is inside or outside by using linear programming:
X - matrix(rnorm(50), 10, 5)
x_i - matrix(rnorm(5), 1, 5)
isin.chull
Hi
Given three vectors
x - c(fish=3, dogs=5, bats=2)
y - c(dogs=1, hogs=3)
z - c(bats=3, dogs=5)
How do I create a multi-way table like the following?
out
x y z
bats 2 0 3
dogs 5 1 5
fish 3 0 0
hogs 0 3 0
('out' is a matrix).
See how the first line shows 'x' has 2 bats, 'y' has
It's usually better to build vectorization in to functions:
beta3- function (n1, n2, n3)
exp(lgamma(n1)+lgamma(n2)+lgamma(n3)-lgamma(n1+n2+n3))
f - function(x){exp(sum(lgamma(x))-lgamma(sum(x)))}
beta3(5,3,8)
[1] 1.850002e-07
f(c(5,3,8))
[1] 1.850002e-07
rksh
On 07/06/2010 01:54 AM,
Hello Jim
you can use ashift() from the same library which does (I think) what you
want.
HTH, Robin
On 07/02/2010 12:05 PM, Jim Hargreaves wrote:
Dear List,
I have a 2,000x10,000 array of time domain data which when plotted
draws a distinct pulse. The matrix is 10,000 pulses of
Hello again Jim
It seems that ashift() from the same package *doesn't* do what you want.
But you can use shift() as follows:
myshift - function(x){shift(x,1-which.max(x))}
a - matrix(runif(30),5,6)
a
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.268955362
Hi
suppose I have a factor 'x':
x - as.factor(c(rep(a,3),b,d))
table(x)
x
a b d
3 1 1
But this is not what I want because
I need to include the fact that the count of c is zero.
I can't just change the levels of x:
levels(x) - c(a,b,c,d)
table(x)
x
a b c d
3 1 1 0
because this
thanks everyone.
I think the motto should be always specify the levels of a factor when
you create it
if you possibly can.
best wishes
Robin
On 06/29/2010 12:39 PM, Felix Andrews wrote:
Just use factor(), not levels(); you can pass a factor to factor() too.
x-
Hello Bradley
I don't think there's an easy way to do what you want because the viewing
angles are internal to p3d(). Frankly p3d() tries to be all things to all
men (the arguments are a mess) and inevitably isn't as flexible as one
might wish.
I take it you want to do this:
data(bunny)
Jim
the 2x2 case is reasonably straightforward because the support
is quite a small set.
With the aylmer package you could do this:
a - matrix(c(1,5,7,8),2,2)
sample(seq_along(allprobs(a)),100,replace=TRUE,prob=allprobs(a))
[1] 3 2 4 1 3 4 4 4 4 3 3 4 4 2 3 4 5 4 3 3 4 4 2 1 4 3 3 3 4 2 3
Hi
library(partitions)
jj - blockparts(rep(9,8),17)
dim(jj)
gives 318648
HTH
rksh
baptiste auguie wrote:
Dear list,
In a little numbers game, I've hit a performance snag and I'm not sure
how to code this in C.
The game is the following: how many 8-digit numbers have the sum of
their
system elapsed
0.160 0.068 0.228
In some ways I think this is close to Hadley's suggestion, though I
didn't know how to implement it.
Thanks a lot to everybody who participated, I have learned interesting
things from a seemingly innocuous question.
Best regards,
baptiste
2009/12/21 Robin
)
}
Or am I missing something?!
Ted.
On 21-Dec-09 07:57:32, Robin Hankin wrote:
Hi
library(partitions)
jj - blockparts(rep(9,8),17)
dim(jj)
gives 318648
HTH
rksh
baptiste auguie wrote:
Dear list,
In a little numbers game, I've hit a performance snag and I'm not sure
how to code
The aylmer package has some functionality in this regard
which you may find useful.
In particular, you can use good() to get a feel for the
number of tableaux that are consistent with the
specified marginal totals:
good(dat2)
[1] 42285210
good(dat3)
[1] 2.756286e+12
HTH
rksh
Søren
Hi
try
R library(magic)
R ashift(diag(5),1)
HTH
rksh
enrique Dallazuanna wrote:
Try this:
N - 5
diag(1, N)[c(N, 1:(N - 1)),]
On Fri, Dec 11, 2009 at 1:47 PM, Moohwan Kim kmhl...@gmail.com wrote:
Dear R family
I am attempting to create a matrix. e.g.,
0 0 0 0 1
1 0 0 0 0
0 1 0 0
Hi
I have a factor 'f' and a named list 'jj'.
I want names(jj) to match up with levels(f).
How do I use levels(f) to access elements of jj?
f - factor(c(pigs,pigs,slugs))
f
[1] pigs pigs slugs
Levels: pigs slugs
jj - list(pigs=1:10,slugs=1:3)
My attempts to produce jj$pigs all give
(pigs = 1:10, slugs = 1:3)
jj[levels(f)[1]]
jj[[levels(f)[1]]]
Best,
Dimitris
Robin Hankin wrote:
Hi
I have a factor 'f' and a named list 'jj'.
I want names(jj) to match up with levels(f).
How do I use levels(f) to access elements of jj?
f - factor(c(pigs,pigs,slugs))
f
[1] pigs pigs
Hi
fexact.c points you to the original ACM paper:
/*
ALGORITHM 643, COLLECTED ALGORITHMS FROM ACM.
THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE,
VOL. 19, NO. 4, DECEMBER, 1993, PP. 484-488.
-
You may find the
Peng
the Brobdingnag package includes a vignette that gives
a step-by-step guide to creating a simple package that
uses S4.
best wishes
Robin
Peng Yu wrote:
I'm looking for some tutorial on S4. I only find the following one,
which is not in English. Can somebody let me know if there is any
Hi
I deal with long vectors almost all of whose elements are zero.
Typically, the length will be ~5e7 with ~100 nonzero elements.
I want to deal with these objects using a sort of sparse
vector.
The problem is that I want to be able to 'add' two such
vectors.
Toy problem follows. Suppose I
Hi
interesting blog!
not strictly relevant, but there are various
number-theoretic functions implemented
in the elliptic package which
you might find useful.
best wishes
Robin
murali.me...@fortisinvestments.com wrote:
Folks,
I put up a brief note describing my naive attempts to compute
Hi
I have a data frame with timeseries information like this:
year cell Q1Q2 Q3 Q4
1940 1 1.2 1.4 1.41.9
1941 1 2.9 2.1 3.4 2.4
1942 1 2.7 3.2 1.52.6
1940 2 1.4 2.1 2.62.4
1941 2 2.4 1.4 1.4
Hi
R-2.8.1, Suse 11.1
I'm having problems with pdf(). In the following
transcript, file 'f.pdf' does not use the expected symbols for the plot.
It uses a 'q' letter instead of the open circle I get when
viewing the graphics window.
I also get the same under r47678.
Does anyone else get
I think the OP was asking about test suites that test the software.
The R package structure includes a test/ directory which you can use
to put tests.
For example, in the onion package I check that I have got my
signs and multiplication table correctly implemented:
stopifnot(Hi*Hj == Hk)
Gundala
f - function(n){expand.grid(rep(list(seq_len(4)),n))}
HTH
Robin
Gundala Viswanath wrote:
Dear all,
Is there an efficient way in R to construct all strings from 4 bases (ATCG).
If we want a length L string, there are 4 ^ L possible strings of such.
e . g with L = 2 we have
Hi Borja
library(elliptic)
?myintegrate
HTH
rksh
Borja Soto Varela wrote:
Dear R-user
I need a function to approximate a complex integration. My function is:
aprox2=function(s,x,rate){
dexp(x,rate)*exp(-s*x)
}
where argument s is a complex number. I can't use the integrate function
Hi
start simple!
Work out *each* row combined with *each* row,
to give (in your case) a 26-by-26 matrix.
Only after you have got this working, start thinking about
making it run faster [eg by
only evaluating the upper triangular entries]
To do a nested loop, do
M - matrix(0,n,n)
for(i in
Rory
there are several packages that perform this.
I would use permn() of the combinat library, then, if
lexicographical order is important, sort it explicitly.
HTH
rksh
[EMAIL PROTECTED] wrote:
Hi all
Here is a rather naive implementation of the SEPA algorithm for generating
lexical
Hi
use the logarithmic representation for your problem.
The Brobdingnag package uses such a form in a (more-or-less)
user-transparent manner.
HTH
rksh
Marc Jekel wrote:
Dear R Fans,
I have a simple probem but cannot find any reference to the soultion.
I want to do calculations with small
The hypergeo package should be able to deal with this,
although the function you specify below looks like a degenerate case
(if I understand it correctly) so the convergence rate
is likely to be slow.
Let me know how you get on
best wishes
Robin (author of hypergeo)
Jarle Brinchmann wrote:
Hello
a good place to start is R-and-octave.txt, in the contributed docs
section of CRAN.
This translates between common matlab and R commands
HTH
rksh
Michael Zak wrote:
Hi there
I know, I'm sure you discussed this stuff 100 times, but I really have
a basic understanding problem, if
Hello.
The Brobdingnag package uses that identity for a logarithmic
representation and also has a hack for negative numbers.
HTH
rksh
A.Noufaily wrote:
Many thanks for your suggestions...
I am still checking which one is the most useful for my simulations.
Concerning using logs, this
This comes up from time to time. The problem is that one needs complex
numbers to address taking the third root: there are three cube roots
for any nonzero number (real or complex). To wit:
(-0.084121928394+0i)^(1/3)
[1] 0.2190818+0.3794609i
(-0.084121928394-0i)^(1/3)
[1]
of expand.grid() [but you will have to
coerce it to a matrix]
HTH
rksh
Thank you,
Laura
On Wed, Sep 24, 2008 at 8:27 PM, Laura Bonnett
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
Can I ask what a and v are?
Thanks,
Laura
On Sat, Aug 23, 2008 at 11:41 AM, Robin Hankin
Megh
corr.matrix() in the 'emulator' package can calculate
P-D variance matrices using any of a very broad
class of methods.
HTH
rksh
Megh Dal wrote:
I want to generate a valid variance-covariance matrix. One way could be to
generate some random sample from multivariate normal
Paul
you might find the view() function in the 'elliptic' package useful.
This function implements various methods to visualize functions
over the complex plane.
HTH
rksh
Paul Smith wrote:
Dear All,
The function curve() draws the graph of functions from R to R. Is
there some homologous
First bit:
x - c(3,2,2)
expand.grid(sapply(x,seq_len))
Var1 Var2 Var3
1 111
2 211
3 311
4 121
5 221
6 321
7 112
8 212
9 312
10122
11222
12322
Laura Bonnett wrote:
crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]]
crosstable is just a crosstabulation of an n+2-dimensional dataset and
I am trying to pick out those that are in combination 'd' of expand.
So for example, for 5-dimensional data using your example:
Var1
Adaikalavan Ramasamy wrote:
I agree! The best way to learn (and remember for longer) is to teach
someone else about it.
And there is not reason not to repeat some of the anlysis done on SAS
with R. That way you can verify your outputs or compare the
presentations. If you consistently find
Hi Wensei.
Why not do as I do? Find an interesting area of numerical
computation (perhaps not statistical) that has not been
implemented in open-source. Then write an R package
for it, under GPL-2, then write an article about the new
package in R-news or JSS.
works for me.
Best wishes
Hi Yuan, Lucien, List.
try this:
f -
function (...)
{
args - list(...)
if(length(args)==0){
return(NULL)
}
if (length(args) == 1) {
return(args[[1]])
}
if (length(args) 2) {
jj - do.call(Recall, c(args[-1]))
return(do.call(Recall,
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages
/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help
-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r
://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way
:
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
a - CalculateNormalizingConstant(a)
and after this, object a would then have the numerically
computed NC in place.
Is this a Good Idea?
Are there any PDFs implemented in R in which this is an issue?
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty
-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre
/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
]
[1,]147
[2,]258
[3,]369
x
[,1] [,2] [,3] [,4] [,5]
[1,]27 1279
[2,]49 148 10
[3,]36900
Note the zeros at lower-right.
Is there a ready-made solution to this?
--
Robin Hankin
Uncertainty
]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist
-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre
advantage of coercion is to avoid integer overflow.
Indeed, as I told Robin Hankin privately, that was the design reason.
Brian Ripley also reminded me that the sum() of integers is an integer,
behaviour that I find desirable.
The reason for my starting this thread is that
sometimes I actually
, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman
mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way
]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
is this?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http
://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R
-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r
, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
deviation page
says. Is this what you meant?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman
-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
http://www.R-project.org/posting-
guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
}
\caption{snipped caption}
\end{table}
=
jj - matrix(c(2, 3, 4, 1,
0, 5, 7, NA,
3, 7, NA, 4,
2, NA, NA, 2
),byrow=TRUE,nrow=4)
jj - rbind(jj,apply(jj,2,sum,na.rm=TRUE))
jj - cbind(jj,apply(jj,1,sum,na.rm=TRUE))
jj
@
--
Robin
68 matches
Mail list logo