Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
The Statistics and Machine Learning with R Workshop

You're reading from  The Statistics and Machine Learning with R Workshop

Product type Book
Published in Oct 2023
Publisher Packt
ISBN-13 9781803240305
Pages 516 pages
Edition 1st Edition
Languages
Author (1):
Liu Peng Liu Peng
Profile icon Liu Peng

Table of Contents (20) Chapters

Preface 1. Part 1:Statistics Essentials
2. Chapter 1: Getting Started with R 3. Chapter 2: Data Processing with dplyr 4. Chapter 3: Intermediate Data Processing 5. Chapter 4: Data Visualization with ggplot2 6. Chapter 5: Exploratory Data Analysis 7. Chapter 6: Effective Reporting with R Markdown 8. Part 2:Fundamentals of Linear Algebra and Calculus in R
9. Chapter 7: Linear Algebra in R 10. Chapter 8: Intermediate Linear Algebra in R 11. Chapter 9: Calculus in R 12. Part 3:Fundamentals of Mathematical Statistics in R
13. Chapter 10: Probability Basics 14. Chapter 11: Statistical Estimation 15. Chapter 12: Linear Regression in R 16. Chapter 13: Logistic Regression in R 17. Chapter 14: Bayesian Statistics 18. Index 19. Other Books You May Enjoy

Working with stringr

The stringr package provides a cohesive set of functions that all start with str_ and are designed to make working with strings as easy as possible.

Let’s start with the basic functions of stringr by replicating the same results from the previous exercise.

Basics of stringr

The str_c() function from the stringr package can concatenate multiple strings with similar functionalities as in paste(). Let’s see its use in action.

Exercise 3.9 – combining strings using paste()

In this exercise, we will reproduce the same as what we did in Exercise 3.8 using str_c():

  1. Concatenate statistics with workshop with a separating space in between:
    >>> str_c("statistics", "workshop", sep = " ")
    "statistics workshop"

    We can use the sep argument to specify the separator between strings.

  2. Combine a vector of statistics and workshop with course:
    >>> str_c(c("statistics", "...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}