saving . . . saved Conditional statement assignment has been deleted. Conditional statement assignment has been hidden .
Conditional statement assignment
Title
Question
assignment question:
Use the built-in data set iris. Find the Species, in which Sepal.Length is greater than Petal.Length. 
2. Count all such Species.

solution:
 iris$find = ifelse(iris$Sepal.Length > iris$Petal.Length,1,0)
View(iris)
 sum(ifelse(iris$Sepal.Length > iris$Petal.Length,1,0))
[1] 150

Is it correct or any better code can be implemented ?
 


R Conditional-Statements 10-11 min 40-50 sec 06-05-20, 1:35 a.m. suhailalphacs

Answers:

It is one of the possible ways.
06-05-20, 8:16 p.m. sudhakarst


Log-in to answer to this question.