How to Solve the R Error – Unexpected String Constant in Code (2 Examples)

In this tutorial, I’ll show how to fix the error “unexpected string constant in X” in R programming.

Example 1: Reproducing Error Message: “unexpected string constant in X”

my_values <- letters[1:3]        # Creating vector
my_values""                      # How to replicate the error message
# Error: unexpected string constant in "my_values"""

Example 2: Solving Error Message: “unexpected string constant in X”

my_values                        # How to fix the error message
# "a" "b" "c"

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

Menu
Top