Suppose you have a character vector:
char <- c(\"one\", \"two\", \"three\")
When you make reference to an index value, you get the follo
Here is one combining noquote
and paste
:
noquote(paste("Argument is of length zero",sQuote("!"),"and",dQuote("double")))
#[1] Argument is of length zero ‘!’ and “double”
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"
I'm just guessing, is this in the ball park of what you're trying to achieve?
> a <- "a"
> a
[1] "a" # quote yes
> as.factor(a)
[1] a #quote no
Just try noquote(a)
noquote("a")
[1] a