R: convert quote to string

Given a variable foothat is a quote

foo = quote(1+2)
class(foo)
# [1] "call"

I want to extract a string "1+2". How?

PS: as.character(foo)just giving me the components.

+4
source share
1 answer

We can use deparse

deparse(foo)
#[1] "1 + 2"
+4
source

Source: https://habr.com/ru/post/1624460/


All Articles