Dirk Eddelbuettel wrote:
> On 17 October 2007 at 10:44, Rainer M Krug wrote:
> | I create one pdf file with plots via pdf() and one text file with text
> | via sink() that works very nice. But I would prefer to have one pdf file
> | with plots and the text which I store in the te
Hi
I have two vectors, prob and size, and I want to add the random deviates
of these two, i.e.
sum(
sapply(
1:length(prob),
function(n){ rbinom(1, size(n), prob(n) }
)
)
My problem is that I have to do this for a large number of value
combinations. Is there a
Hi
I have a vector
x <- c(1, 2, 3, 4, 5)
and I want to "flip" it around, i.e. I need
5, 4, 3, 2, 1
Is there a ssolution apart from
y <- x[length(x):1]
I am also looking for the same for a matrix M, i.e.
1 2 3
4 5 6
7 8 9
should become
7 8 9
4 5 6
1 2 3
again, I am using
M[1:dim(M)[1],
you gave:
>> x
> [,1] [,2] [,3]
> [1,]123
> [2,]456
> [3,]789
>>
>> apply(t(x),1,rev)
> [,1] [,2] [,3]
> [1,]789
> [2,]4 5 6
> [3,]123
>
>
> On Tue, 23 Oct 2007, Rainer M
b <- matrix(1:9,3,3)
> > b
> [,1] [,2] [,3]
> [1,]147
> [2,]258
> [3,]369
> > arev(b)
> [,1] [,2] [,3]
> [1,]963
> [2,]852
> [3,] 741
> >
>
>
>
>
>
>
Hi
I have another question concerning matrices:
I have two matrices:
> b <- matrix(1:25,5,5,byrow=T)
> b
[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]6789 10
[3,] 11 12 13 14 15
[4,] 16 17 18 19 20
[5,] 21 22 23 24 25
and
> d
element of the vector
> 'size', which in R is written 'size[ n ]' .
>
> In which case
>
> sum (rbinom( length(prob) , size, prob ) )
>
> works.
>
> Chuck
>
> On Tue, 23 Oct 2007, Rainer M Krug wrote:
>
>> Hi
>>
>> I have
ded recipient, please notify Faculty of Agricultural
> Sciences immediately and delete this email.
>
>
>
>
>
>> -Oprindelig meddelelse-
>> Fra: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] På vegne af Rainer M Krug
>> Sendt: 24. oktober 2007 09:11
>
= 0.5)
> Z <- X + Y
>
> d(Z)( 0:18 ) # the pmf
> r(Z)( n = 5 ) # random variates
>
> Please note, however, that size and prob must be of length 1.
>
> Best,
> Jay
>
> On 10/24/07, Rainer M. Krug <[EMAIL PROTECTED]> wrote:
>> Frede Aakmann Tøge
401 - 409 of 409 matches
Mail list logo