---
title: "Discussion on \"Loops in R (Chapter 1 Episode 6)\" | Hashnode"
description: "Discussion on \"Loops in R (Chapter 1 Episode 6)\". In this lesson, I talked about the three kinds of loops: repeat , while and for loop and their use cases."
url: "https://hashnode.com/posts/loops-in-r-chapter-1-episode-6/632049906c86d75accc80c5f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Loops in R (Chapter 1 Episode 6)](https://blog.rukayatbalogun.xyz/loops-in-r-chapter-1-episode-6?utm_source=hashnode&utm_medium=feed)

In this lesson, I talked about the three kinds of loops: repeat , while and for loop and their use cases.

Sep 13, 2022 · 3 min read · blog.rukayatbalogun.xyz  
Read the article

-   [#r-programming](https://hashnode.com/tag/r-programming)
-   [#loop](https://hashnode.com/tag/loop)
-   [#data-science](https://hashnode.com/tag/data-science)

## Written by

[Rukayat Balogun](https://hashnode.com/@code-with-kemi)

@code-with-kemi · 🇳🇬

  
[View profile](https://hashnode.com/@code-with-kemi)

Web Development and Data Science

## Responses 1

Markdown supported · ⌘↵ to post

[Rukayat Balogun](https://hashnode.com/@code-with-kemi)

[Sep 13, 2022](https://hashnode.com/posts/loops-in-r-chapter-1-episode-6/632049906c86d75accc80c5f/comment/632058356c86d75accc80f64)

Write a program that combines all three loops: Write a program that iterates over the English alphabet and prints each vowel letter 2 times before it then moves on to the next letter

[Itz Mhizter Dan](https://hashnode.com/@danilexy405)

[Sep 13, 2022](https://hashnode.com/posts/loops-in-r-chapter-1-episode-6/632049906c86d75accc80c5f/comment/632058356c86d75accc80f64#reply-632064d75483096daa0a79e7)

l <- LETTERS\[1:26\] count <- 0 vowel <- c("A","E","I","O","U") for ( j in l) { if (j %in% vowel){ count <- 0 while(count < 2){ print(j) count <- count + 1 } } else{ print(j) } }

[Eniola Elemide](https://hashnode.com/@Deenero)

[Sep 13, 2022](https://hashnode.com/posts/loops-in-r-chapter-1-episode-6/632049906c86d75accc80c5f/comment/632058356c86d75accc80f64#reply-632076b3af1ce46dbc5436c1)

alph <- LETTERS\[1:26\] vow <- c("A","E","I","O","U")

for (x in alph){ if(x %in% vow){ count <- 1 while(count < 2){ repeat { print(x) count <- count + 1 if (count > 2){ break } } } }else { print(x) } }
