How to Solve – Error Could not Find Function … in R (Example Code)

In this post you’ll learn how to solve the R programming error “could not find function X” in R.

Example: Solving the Error Message: Could not Find Function …

str_detect("XXAXXBXXC", "A")    # Reproduce error message
# Error in str_detect("XXAXXBXXC", "A") : 
#   could not find function "str_detect"

First, we have to install and load the dplyr package:

install.packages("stringr")     # Install & load stringr package
str_detect("XXAXXBXXC", "A")    # Run function again
# [1] TRUE

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed