Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Loops and Conditionals in R - short
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Corey Chivers
March 22, 2013
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Loops and Conditionals in R - short
Corey Chivers
March 22, 2013
More Decks by Corey Chivers
See All by Corey Chivers
Germination Project Data Science at Penn Medicine
cjbayesian
1
350
From Predictions to Decisions
cjbayesian
1
650
NIPS 2017 Summary
cjbayesian
1
1.7k
Validation des prévisions écologiques utilisant VMAPP: Validation métrique appliquée à des prévisions probabilistes
cjbayesian
1
170
From Whale Calls to Dark Matter - Competetive Data Science with R and Python
cjbayesian
0
1.5k
Introduction to Likelihood-based methods
cjbayesian
1
890
Implications of uncertainty: Bayesian modelling of aquatic invasive species spread
cjbayesian
0
400
Future Avenues for Open Data
cjbayesian
0
280
Montreal R Users Data Dive - Bike accidents
cjbayesian
0
130
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building AI with AI
inesmontani
PRO
1
1.1k
Amusing Abliteration
ianozsvald
1
250
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
340
Building an army of robots
kneath
306
46k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
490
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
240
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Skip the Path - Find Your Career Trail
mkilby
1
180
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
860
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Transcript
•R is a full fledged programming language. It can do
loops and conditionals. i <- runif(1,0,100) if(i <= 50) { print(‘i is pretty small’) } Control Structures for(i in 1:100) { print(i) }
•A loop will be executed over and over. Control Structures
fruits<- c('apple','orange','banana','pear') for(fruit in fruits) { print(fruit) }
•Combining loops with conditionals can be very powerful. Control Structures
fruits<- c('apple','orange','banana','pear') for(fruit in fruits) { print(fruit) if(fruit == 'banana') print(paste(fruit,'rama!',sep='') }
Challenge 1) Print out all the numbers between 1 and
100, but if the number is a multiple of 3, print ‘fizz’ instead. 2) Extend your code so that for multiples of 5, it prints out ‘buzz’. HINT: To get the remainder of integer division, use %%. Ex: 4 9%%5