# How to Solve the R Error – Unexpected Symbol in Code (2 Examples)

In this post, I’ll explain how to solve the error “unexpected symbol in X” in R.

## Example 1: Reproducing Error Message

a <- 5 # Create some data objects b <- 8 |

a <- 5 # Create some data objects b <- 8

a b # How to reproduce the error message # Error: unexpected symbol in "a b" |

a b # How to reproduce the error message # Error: unexpected symbol in "a b"

## Example 2: Solving Error Message – “unexpected symbol in X”

a * b # Inserting operator between symbols # 40 |

a * b # Inserting operator between symbols # 40