Conditional Statements - English
- Questions posted on Forums
- R Tutorials - English
-
Conditional statement assignment
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] 150Is it correct or any better code can be implemented ?
10-11M 40-50SMay 15, 2025, 1:04 a.m. suhailalphacs
-
Some problem on the execution of the statement
I am trying to execute this statement. In this, I have to get one output i.e. India won the first ODI but I got two times instead of one. please provide me a useful solutionif(inScore[1]> ausScore[1])( print("India won the first ODI"))
03-04M 20-30SMay 14, 2025, 11:59 p.m. sumankr545
-
Conditional Statements
Count all such Species.Answer for Assignment Question
09-10M 0-10SMay 15, 2025, 3:33 p.m. bvs.nnsvidya@gmail.com
-
Conditional Statements
Use the built-in data set iris. Find the Species, in which Sepal.Length is greater than Petal.Length. please send the answer
11-12M 0-10SMay 15, 2025, 4:49 p.m. bvs.nnsvidya@gmail.com
-
Adding a new column
Is it possible to add a new column to a specific position in a dataframe?
09-10M 30-40SMay 15, 2025, 4:05 p.m. vijayaprabhu
-
1
Overview of R and RStudio -
2
Installing R and RStudio on Linux -
3
Installing R and RStudio on Windows -
4
Introduction to basics of R -
5
Introduction to Data Frames in R -
6
Introduction to RStudio -
7
Introduction to R script -
8
Working directories in RStudio -
9
Indexing and Slicing Data Frames -
10
Creating Matrices using Data Frames -
11
Operations on Matrices and Data Frames -
12
Merging and Importing Data -
13
Data types and Factors -
14
Lists and its Operations -
15
Plotting Histograms and Pie Chart -
16
Plotting Bar Charts and Scatter Plot -
17
Introduction to ggplot2 -
18
Aesthetic Mapping in ggplot2 -
19
Data Manipulation using dplyr Package -
20
More Functions in dplyr Package -
21
Pipe Operator -
Conditional Statements -
23
Functions in R
Questions posted on ST Forums:
Outline:
About conditional statements Syntax of if, else and else if statements Use if, else and else if statements Use if else function Arguments of if else function Add a new column in an existing data frame Read and store a csv file View a data frame Count true values in a column Use sum function