Continue your journey to becoming an R ninja by learning about conditional statements, loops, and vector functions.Start Course for Free
6 Hours14 Videos81 Exercises550,844 Learners6950 XPData Scientist with R TrackData Scientist Professional with R TrackR Programming Track
Create Your Free Account
Loved by learners at thousands of companies
Intermediate R is the next stop on your journey in mastering the R programming language. In this R training, you will learn about conditional statements, loops, and functions to power your own R scripts. Next, make your R code more efficient and readable using the apply functions. Finally, the utilities chapter gets you up to speed with regular expressions in R, data structure manipulations, and times and dates. This course will allow you to take the next step in advancing your overall knowledge and capabilities while programming in R.
Conditionals and Control FlowFree
In this chapter, you'll learn about relational operators for comparing R objects, and logical operators like "and" and "or" for combining TRUE and FALSE values. Then, you'll use this knowledge to build conditional statements.Relational Operators50 xpEquality100 xpGreater and less than100 xpCompare vectors100 xpCompare matrices100 xpLogical Operators50 xp& and |100 xp& and | (2)100 xpReverse the result: !50 xpBlend it all together100 xpConditional Statements50 xpThe if statement100 xpAdd an else100 xpCustomize further: else if100 xpElse if 2.050 xpTake control!100 xp
Loops can come in handy on numerous occasions. While loops are like repeated if statements, the for loop is designed to iterate over all elements in a sequence. Learn about them in this chapter.While loop50 xpWrite a while loop100 xpThrow in more conditionals100 xpStop the while loop: break100 xpBuild a while loop from scratch100 xpFor loop50 xpLoop over a vector100 xpLoop over a list100 xpLoop over a matrix100 xpMix it up with control flow100 xpNext, you break it100 xpBuild a for loop from scratch100 xp
Functions are an extremely important concept in almost every programming language, and R is no different. Learn what functions are and how to use them—then take charge by writing your own functions.Introduction to Functions50 xpFunction documentation100 xpUse a function100 xpUse a function (2)100 xpUse a function (3)100 xpFunctions inside functions100 xpRequired, or optional?50 xpWriting Functions50 xpWrite your own function100 xpWrite your own function (2)100 xpWrite your own function (3)100 xpFunction scoping50 xpR passes arguments by value50 xpR you functional?100 xpR you functional? (2)100 xpR Packages50 xpLoad an R Package100 xpDifferent ways to load a package50 xp
The apply family
Whenever you're using a for loop, you may want to revise your code to see whether you can use the lapply function instead. Learn all about this intuitive way of applying a function over a list or a vector, and how to use its variants, sapply and vapply.lapply50 xpUse lapply with a built-in R function100 xpUse lapply with your own function100 xplapply and anonymous functions100 xpUse lapply with additional arguments100 xpApply functions that return NULL50 xpsapply50 xpHow to use sapply100 xpsapply with your own function100 xpsapply with function returning vector100 xpsapply can't simplify, now what?100 xpsapply with functions that return NULL100 xpReverse engineering sapply50 xpvapply50 xpUse vapply100 xpUse vapply (2)100 xpFrom sapply to vapply100 xp
Mastering R programming is not only about understanding its programming concepts. Having a solid understanding of a wide range of R functions is also important. This chapter introduces you to many useful functions for data structure manipulation, regular expressions, and working with times and dates.Useful Functions50 xpMathematical utilities100 xpFind the error100 xpData Utilities100 xpFind the error (2)100 xpBeat Gauss using R100 xpRegular Expressions50 xpgrepl & grep100 xpgrepl & grep (2)100 xpsub & gsub100 xpsub & gsub (2)50 xpTimes & Dates50 xpRight here, right now100 xpCreate and format dates100 xpCreate and format times100 xpCalculations with Dates100 xpCalculations with Times100 xpTime is of the essence100 xp
In the following tracksData Scientist with RData Scientist Professional with RR Programming
PrerequisitesIntroduction to R
Data Science Instructor at DataCamp
Filip is the passionate developer behind several of DataCamp's most popular Python, SQL, and R courses. Currently, Filip leads the development of DataCamp Workspace. Under the motto 'Eat your own dog food', he uses the techniques DataCamp teaches its students to understand how users learn on and interact with DataCamp. Filip holds degrees in Electrical Engineering and Artificial Intelligence.
Don’t just take our word for it
*4.5from 61 reviews
- Douglas S.3 days
The course has a very good content.
- Thierno D.13 days
- Kevin T.14 days
The instructor was very good
- Youngkee J.19 days
- Lisa C.19 days
I thought this course worked well - I completed this on my mobile and generally it worked well. It easier if you do it a concisely as possible to consolidate steps.
"The course has a very good content."
"The instructor was very good"
Join over 11 million learners and start Intermediate R today!
Create Your Free Account