Skip to content

if else statements in R

3 messages · Michael Rennie, Andrew Perrin, Timur Elzhov

#
This is untested, so try it first, but my approach would be:

W<- function(w)
{
W[i]<-ifelse(comp[i,1]==1, Wo, (work[i-1,5]work[i-1,13]*/Ef))
}

Best,
Andy Perrin

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists at perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
On Mon, 30 Jun 2003, Michael Rennie wrote:

            
#
On Mon, Jun 30, 2003 at 11:21:52AM -0400, Michael Rennie wrote:

            
"==" is comparison operator, but "=" is assignment one.
This code also doesn't work:
Error: syntax error

But this works:
+ 

Chack also help("=="), help("=")

--
WBR,
Timur.