Remove quotes from a character vector in R

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

Just try noquote(a)

noquote("a")

[1] a


as.name(char[1]) will work, although I'm not sure why you'd ever really want to do this -- the quotes won't get carried over in a paste for example:

> paste("I am counting to", char[1], char[2], char[3])
[1] "I am counting to one two three"

There are no quotes in the return value, only in the default output from print() when you display the value. Try

> print(char[1], quote=FALSE)
[1] one

or

> cat(char[1], "\n")
one

to see the value without quotes.