oftware, 46(8), 1-20.
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
d object '/usr/lib64/R/library/gsl/libs/gsl.so':
>>> libgsl.so.0: cannot open shared object file: No such file or directory
>>> ERROR: loading failed
>>> * removing ‘/usr/lib64/R/library/gsl’
>>>
>>>> sessionInfo()
>>>
>>> R v
<- iden(M) : subscript out of bounds
>
> Or I must be wrong somewhere.
>
>
> Feng
>
>
> On Sep 24, 12:39 pm, Robin Hankin wrote:
>
>> Hello
>>
>> convex hulls in large numbers of dimensions are hard.
>>
>> For your problem, though, o
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=FA
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
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
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 length
ctor(c(rep("a",3),"b","d"), levels = letters[1:5])
table(x)
x
a b c d e
3 1 0 1 0
Cheers,
-Felix
On 29 June 2010 20:59, Robin Hankin wrote:
Hi
suppose I have a factor 'x':
x<- as.factor(c(rep("a",3),"b","
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
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)
p3
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
g like:
all <- 0
for(i in (2:8)){
jj <- blockparts(rep(9,8),17)
all <- all + dim(jj)
}
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 augui
ser 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
200
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 di
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 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 0
0 0 1 0 0
uot;pigs", "slugs"))
jj <- list(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 a
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$pig
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 discussion
Hi
I want a generalization of tabulate() which works on rows of a matrix.
Suppose I have an integer matrix 'observation':
> observation
y1 y2 y3
1 4 0
1 4 0
2 0 3
4 1 0
0 5 0
0 1 4
2 0 3
Each row corresponds to a (multivariate) observation. Note that the
first two rows are identical: this mea
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
ummary(theSum)
hth,
b
On Sep 8, 2009, at 10:19 AM, Henrique Dallazuanna wrote:
Try this:
abMerge <- merge(a, b, by = 'index', all = TRUE)
list(index = abMerge$index, val = rowSums(abMerge[,2:3], na.rm = TRUE))
On Tue, Sep 8, 2009 at 10:06 AM, Robin Hankin wrote:
Hi
I deal w
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 Gol
I too have had many problems with if-else.
My solution is to always always always
use the line
"} else {"
in any if-else construction. This guarantees that
there won't be problems of the sort discussed here.
HTH
rksh
Martin Maechler wrote:
"D" == Dani
on Tue, 24 Feb 2009 14:09:36 -
Feng
checkout the Brobdingnag package:
> library(Brobdingnag)
> exp(1000)/(exp(1007)+5)
[1] NaN
> as.numeric(exp(as.brob(1000))/(exp(as.brob(1007))+5))
[1] 0.000911882
>
Feng Li wrote:
Dear R,
I have two questions:
1, Why both R and Matlab give 0*Inf==NaN? To my knowledge, it should be zer
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 this
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.43.4
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)
sto
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 AA
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
b
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 p
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 n
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 a
Annette
I understand your problem.
I think you may find 'blockparts(rep(5,5),5)' helpful.
I'm working on permutations of multisets right now
and expect to have functionality in partitions package
as soon as I finish the Other Ten Thousand Things
On My Things To Do List.arts
Perhaps we could ta
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 m
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] 0.21908
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 distribution
own in advance.
You can get 'd' from a single row 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
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 f
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
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
>
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 dif
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
Ro
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", c(list(ar
enjoy
--
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-pac
t;
> --
> Martin Morgan
> Computational Biology / Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N.
> PO Box 19024 Seattle, WA 98109
>
> Location: Arnold Building M2 B169
> Phone: (206) 667-2793
>
> __
> R-help
gt; Christophe
>
> __
> 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-con
://newton.ex.ac.uk/research/emag
> http://projects.ex.ac.uk/atto
>
> __
> 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
>
gt; [edit]
> On 3 Mar 2008, at 19:17, Douglas Bates wrote:
>
>>>>
>>>>
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
___
ecute something like
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 Neutra
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
> 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 Ce
t?
>
> Can anyone tell me how to correct that?
>
> Regards,
>
>
>
> -
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/li
> skype:gustaf_rydevik
>
> __
> 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-containe
s[[1]]
b <- args[[2]]
dima <- dim(a)
dimb <- dim(b)
stopifnot(length(dima) == length(dimb))
out <- array(0, pmax(dima, dimb))
return(do.call("[<-", c(list(out), lapply(dima, seq_len),
list(a))) + do.call("[<-", c(li
468 10
> x2
[,1] [,2] [,3]
[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-ma
> A(1+(1-x)*(1+y)/x-A))=B
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-projec
ways to find more information about why it is singular?
>
> Thanks.
> __
> 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, s
s no
> coercion per se.
>
>> However, one 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.
T
__
> 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 A
ide 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
_
didn't get it. Any help? Thanks
>
> Ilham
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-pro
On 10 Nov 2007, at 07:32, Prof Brian Ripley wrote:
> On Fri, 9 Nov 2007, Robin Hankin wrote:
>
>> Hi
>>
>> [R-2.6.0, macOSX 10.4.10].
>>
>> The helppage says that rowSums() and colSums()
>> are equivalent to 'apply' with 'FUN = sum
ums() returns a float.
Why 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-he
er
>
> __
> 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,
anks
>
> Rainer
>
> __
> 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-containe
__
> 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,
gt; __
> 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, reproduci
because of A" which is pretty much what the
standard 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-
; 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
puter Engineering,
> Texas A&M University,
> College Station, TX
>
> __
> 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 comme
quot;, "combinat", and "partitions" include related
functionality.
However, none of these (AFAICS) solves your problem, which is now
on my Things To Do List [don't hold your breath].
What is your application?
>
> Thank you So much.
--
Robin Hankin
Uncertain
> tia, Randy
> [[alternative HTML version deleted]]
>
> __
> 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
>
I can't think of a way to arrange things
so that: (i) I have only one set of numbers to maintain,
and (ii) an NA appears as a "-" in the LaTeX table.
best wishes
rksh
On 14 Sep 2007, at 09:52, Gavin Simpson wrote:
> On Fri, 2007-09-14 at 09:34 +0100, Robin Hankin wrote:
&g
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 Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-
print(c(i,j,k))
Y[k,i] <- X[i,j]
Y[k,j] <- X[j,i]
}
k <- k+1
}
}
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
___
t; 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, Sou
81 matches
Mail list logo