Remove quotes from a character vector in R

前端 未结 10 2285
盖世英雄少女心
盖世英雄少女心 2020-11-29 01:06

Suppose you have a character vector:

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

When you make reference to an index value, you get the follo

10条回答
  •  醉话见心
    2020-11-29 01:32

    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.

提交回复
热议问题