Logical Statements and Loops in R

R Logo and code

PLEASE NOTE THAT THIS WILL BE AN HYBRID TRAINING EVENT!

When booking you will be able to decide if you want to attend remotely (via Teams) or in-person. Please be aware that in-person availability is limited by the current COVID19 regulations.

This workshop will focus on developing practical skills for writing and using logical statements and loops in R. A basic understanding of R is assumed, at the level covered in the Introduction to R and RStudio workshop, though participation in that workshop itself is not required in order to attend this workshop. No prior experience with logical statements in any coding language is required. 

Logical statements can be used for both simple calculations and comparisons, as well as for more complex tasks such as setting up conditions for loops, looking and prescreening data before running tests, which can all aid in automating/streamlining scripts. 

The workshop will begin with a theoretical demonstration of the use of logical statements and loops, and how to write them in R. A practical, guided exercise will then follow. All of this will cover topics including: 

  • Logicals and logical statements 

  • Utilising binary logical outputs  

  • If and if Else statements 

  • Loops  

  • While, For and Break statements 

The workshop will ultimately help to develop an understanding of how logical statements and loops work, and how these can be created and implemented in R. Crucially, this will foster a familiarity with the core principles and the capabilities of the software, allowing attendees to confidently apply these, or indeed seek out new concepts, for their own and future research.  

This is an intermediate level workshop. Intermediate events explore specific aspects of the method (libraries, tools etc.) and offer more in-depth understanding of the course topics, without introducing the basics. Some previous knowledge is required to be able to follow the content. 

Those who have registered to take part will receive an email with full details and a link to join the session in advance of the start time. 

After taking part in this event, you may decide that you need some further help in applying what you have learnt to your research. If so, you can book a Data Surgery meeting with one of our training fellows. 

More details about Data Surgeries. 

If you’re new to this training event format, or to CDCS training events in general, read more on what to expect from CDCS training. Here you will also find details of our cancellation and no-show policy, which applies to this event.

Return to the Training Homepage to see other available events.  

6th Floor Teaching Space, Main Library, University of Edinburgh