n...@r-
> project.org] On Behalf Of Philip Wong
> Sent: Wednesday, August 18, 2010 8:46 PM
> To: r-help@r-project.org
> Subject: Re: [R] ifelse command
>
>
> well to be honest, it is a assignment for the Bayesian statistic paper
> I wish
> to take later in the academic
On Aug 18, 2010, at 10:46 PM, Philip Wong wrote:
well to be honest, it is a assignment for the Bayesian statistic
paper I wish
to take later in the academic year. But I'm a slow learner, so I'm
going to
try out some of the assignments posted in the university forum
hoping to get
some p
Hi Dennis,
I see your point about using a different name for the runif() functions,
other then the one I used to stimulate the bias coins. I start to get what
you and David meant after thinking it through for a while regarding with
comparison the biased dice and the uniform distribution, but the
On Wed, Aug 18, 2010 at 7:46 PM, Philip Wong wrote:
>
> well to be honest, it is a assignment for the Bayesian statistic paper I wish
> to take later in the academic year. But I'm a slow learner, so I'm going to
> try out some of the assignments posted in the university forum hoping to get
> some
Hi Josh,
I think I know where does the 50+ warning is coming from,
because I used n in runif(n), similarly I get 50+ warnings if I use
runif(1000). Yet if I use runif(1) the warnings() doesn't show.
--
View this message in context:
http://r.789695.n4.nabble.com/ifelse-command-tp2329538p2330597.
well to be honest, it is a assignment for the Bayesian statistic paper I wish
to take later in the academic year. But I'm a slow learner, so I'm going to
try out some of the assignments posted in the university forum hoping to get
some practice in advance.
Could you please elaborate more on the
Hi:
Here's the problem I had with the OP's function:
On Wed, Aug 18, 2010 at 4:26 AM, David Winsemius wrote:
>
> On Aug 18, 2010, at 5:18 AM, Philip Wong wrote:
>
>
>> hello people,
>> I want to make a biased dice using the sample() function and print out the
>> results after n number of runs, I
sorry missed an "}"
datbig<-numeric(1000)
for (i in 1:1000){
datbig[i] <- mean(sample(1:6, 1000, prob = c(1, 1, 2, 3, 2, 1)/10, replace
= TRUE))
hist(datbig,breaks="FD")
}
--
View this message in context:
http://r.789695.n4.nabble.com/ifelse-command-tp2329538p2329717.html
Sent from the R h
Or try:
datbig<-numeric(1000)
for (i in 1:1000){
datbig[i] <- mean(sample(1:6, 1000, prob = c(1, 1, 2, 3, 2, 1)/10, replace
= TRUE))
hist(datbig,breaks="FD")
--
View this message in context:
http://r.789695.n4.nabble.com/ifelse-command-tp2329538p2329711.html
Sent from the R help mailing list
On Aug 18, 2010, at 5:18 AM, Philip Wong wrote:
hello people,
I want to make a biased dice using the sample() function and print
out the
results after n number of runs, I've successfully generated the dice
using
the following command:
mydie2<-function(n=1000,y=NULL,...){
for(i in 1:n){
x<
Dear Philip,
Trying to use 5 nested ifelse() statements will not be the same as a
series of if statements, and will also be quite messy.
Also, consider these lines of your code:
x <- sample(1:6,n,replace=TRUE,prob=c(1,1,2,3,2,1)/10)
x = runif(n)
First you assign n samples of 1:6 to 'x', then yo
Hi Philip,
Why do you want to use ifelse? It is not an alternative to an if then
else structure, but a way of iterating over a vector with a statement,
returning one value it is true, another if false. An example:
x = runif(100)
y = ifelse(x > 0.5, "Larger", "Smaller")
x
y
cheers,
Paul
On 0
hello people,
I want to make a biased dice using the sample() function and print out the
results after n number of runs, I've successfully generated the dice using
the following command:
mydie2<-function(n=1000,y=NULL,...){
for(i in 1:n){
x<-sample(1:6,n,replace=TRUE,prob=c(1,1,2,3,2,1)/10)
x=runi
13 matches
Mail list logo