Why was ‘u’ used without any hex digits in the character string starting “c:u”?

The character string “c:u” is used without any hex digits because it is representing a Unicode character. The letter “u” after the colon indicates that the following characters are a Unicode code point, rather than a hexadecimal value. This allows for a more concise and standardized way of representing Unicode characters.

Fix: error: ‘u’ used without hex digits in character string starting “‘c:u”


One error you may encounter in R is:

Error: 'U' used without hex digits in character string starting "'C:U"

This error occurs when you attempt to read a file into R and use backslashes ( ) in the file path.

There are two ways to fix this error:

  • Use forward slashes ( / ) in the file path.
  • Use double back slashes ( ) in the file path.

This tutorial shares an example of how to fix this error in practice.

How to Reproduce the Error

Suppose we attempt to read in the following CSV file into R:

#attempt to read in CSV file
data <- read.csv('C:UsersBobDesktopdata.csv')

Error: 'U' used without hex digits in character string starting "'C:U"

We receive an error because we used backslashes in the file path.

Method 1: Fix Error by Using Forward Slashes

One way to fix this error is to use forward slashes ( / ) in the file path:

#read in CSV file using forward slashes in file path
data <- read.csv('C:/Users/Bob/Desktop/data.csv')#view first five rows of data
head(data)

  player assists points
1      A       6     12
2      B       7     19
3      C      14      7
4      D       4      6
5      E       5     10

Notice that we don’t receive an error and we’re able to successfully read in the CSV file.

Method 2: Fix Error by Using Double Back Slashes

Another way to fix this error is to use double back slashes ( ) in the file path:

#read in CSV file using double back slashes in file path
data <- read.csv('C:UsersBobDesktopdata.csv')#view first five rows of data
head(data)

  player assists points
1      A       6     12
2      B       7     19
3      C      14      7
4      D       4      6
5      E       5     10

Additional Resources

The following tutorials explain how to fix other common errors in R:

x