How to Fix the Error in parse – text unexpected symbol in R (2 Examples)

In this article, I’ll show how to avoid the “Error in parse(text) : :1:2: unexpected symbol” in R.

Example 1: Replicating the Error Message in parse – unexpected symbol

parse(text = "1a")          # Try to apply parse
# Error in parse(text = "1a") : <text>:1:2: unexpected symbol
# 1: 1a
#      ^

Example 2: Fixing the Error Message in parse – unexpected symbol

parse(text = "'1a'")        # parse works fine
# expression("1a")

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