Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ifelse1

Conditional Data Selection


Description

Places values into an object according to the logical values in test.

Usage

ifelse1(test, x, y, ...)

Arguments

test

logical object. Missing values (NA) are allowed

x

action to be taken if test is TRUE

y

action to be taken if test is FALSE

...

other

Details

NA values in test cause NAs in the result. Compared with ifelse() in Splus, the length of test in ifelse1() is 1, which means ifelse1() will do only one test.

Value

x or y depending on test.

Author(s)

Knut M. Wittkowski kmw@rockefeller.edu

See Also

Examples

c <- 5
ifelse1(c>=0, 1, -1)
# [1] 1

muStat

Prentice Rank Sum Test and McNemar Test

v1.7.0
GPL (>= 2)
Authors
Knut M. Wittkowski <kmw@rockefeller.edu> and Tingting Song <ttsong@gmail.com>
Initial release
2010-09-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.