Displaying 1 result from an estimated 1 matches for "pieceprice".
2011 Jul 11
1
Ifelse statement
...to use ifelse
instead of if (){} else{}
All the elements seem to work seperately, but combined in the ifelse
statement, it doesn't seem to work.
#The price function is a function which is normally distributed with only
positive answers
price<-function() {abs(rnorm(1,10,25))}
#Before I use pieceprice in the ifelse, I need it to be defined
pieceprice<-cbind()
#Now I define a function with an ifelse statement. So if the binomial
deviation returns one, I add a 'new' price() to the pieceprice vector else I
repeat the last element of the pieceprice vector and add it to pieceprice.
pricec...