Re: [R] ifelse and piecewise function

2010-01-01 Thread David Winsemius
On Jan 1, 2010, at 7:44 PM, roger king wrote: I am a novice user of "R" and I'm learning with R version 2.8.1, using WinEdt_1.8.1, under Widows Vista Home Version. ## The test function below, from a vector input, returns vector values: # and it contains an "ifelse"statement TEST<- fun

Re: [R] ifelse and piecewise function

2010-01-01 Thread jim holtman
Look at what 'loww' is in your function. You are passing in a vector of length 5 and that is what is being passed into integrate for 'lower' which is expecting an object of length 1. So determine what you want to pass in for lower (e.g., min(loww)). On Fri, Jan 1, 2010 at 7:44 PM, roger king wr

[R] ifelse and piecewise function

2010-01-01 Thread roger king
I am a novice user of "R" and I'm learning with R version 2.8.1, using WinEdt_1.8.1, under Widows Vista Home Version. ## The test function below, from a vector input, returns vector values: # and it contains an "ifelse"statement TEST<- function(x) { low<- -x^2 up<- x^4 ifelse(x>=0,up,low )