Re: [R] Confused about a warning message

2011-07-07 Thread David Winsemius
On Jul 7, 2011, at 8:47 PM, Gang Chen wrote: I define the following function to convert a t-value with degrees of freedom DF to another t-value with different degrees of freedom fullDF: tConvert - function(tval, DF, fullDF) ifelse(DF=1, qt(pt(tval, DF), fullDF), 0) It works as expected

[R] Confused about a warning message

2011-07-07 Thread Gang Chen
I define the following function to convert a t-value with degrees of freedom DF to another t-value with different degrees of freedom fullDF: tConvert - function(tval, DF, fullDF) ifelse(DF=1, qt(pt(tval, DF), fullDF), 0) It works as expected with the following case: tConvert(c(2,3), c(10,12),

Re: [R] Confused about a warning message

2011-07-07 Thread David Winsemius
On Jul 7, 2011, at 8:52 PM, David Winsemius wrote: On Jul 7, 2011, at 8:47 PM, Gang Chen wrote: I define the following function to convert a t-value with degrees of freedom DF to another t-value with different degrees of freedom fullDF: tConvert - function(tval, DF, fullDF) ifelse(DF=1,

Re: [R] Confused about a warning message

2011-07-07 Thread Gang Chen
Thanks for the help! Are you sure R version plays a role in this case? My R version is 2.13.0 Your suggestion prompted me to look into the help content of ifelse, and a similar example exists there: x - c(6:-4) sqrt(x) #- gives warning sqrt(ifelse(x = 0, x, NA)) # no warning

Re: [R] Confused about a warning message

2011-07-07 Thread David Winsemius
On Jul 7, 2011, at 10:17 PM, Gang Chen wrote: Thanks for the help! Are you sure R version plays a role in this case? My R version is 2.13.0 I'm not sure, but my version is 2.13.1 Your suggestion prompted me to look into the help content of ifelse, and a similar example exists there: