Remove quotes from a character vector in R

Milktrader picture Milktrader · Mar 7, 2011 · Viewed 167.4k times · Source

Suppose you have a character vector:

char <- c("one", "two", "three")

When you make reference to an index value, you get the following:

> char[1]
[1] "one"

How can you strip off the quote marks from the return value to get the following?

[1] one

Answer

AlexArgus picture AlexArgus · Dec 12, 2014

Just try noquote(a)

noquote("a")

[1] a