{"id":6694,"date":"2022-08-08T12:35:06","date_gmt":"2022-08-08T12:35:06","guid":{"rendered":"https:\/\/www.garysieling.com\/blog\/?p=6694"},"modified":"2022-08-08T12:35:06","modified_gmt":"2022-08-08T12:35:06","slug":"r-quote-vs-expr","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/r-quote-vs-expr\/","title":{"rendered":"R: quote vs expr"},"content":{"rendered":"\n<p><strong>quote<\/strong>: returns it&#8217;s argument (an expression) as is; variables would be filled in later<\/p>\n\n\n\n<p><strong>substitute<\/strong>: the same, <em>except<\/em>, variables from the environment are referenced<\/p>\n\n\n\n<p><strong>expr<\/strong>: superficially, the documentation makes it sounds the same as quote. However, a major difference &#8211; you can build larger arguments. To prevent evaluation of calls, put in !! operator:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>> eval(quote(toupper(quote(letters))))\n&#91;1] \"LETTERS\"\n\n> eval(quote(toupper(!!quote(letters))))\nError in !quote(letters) : invalid argument type\n\n> eval(expr(toupper(!!quote(letters))))\n&#91;1] \"A\" \"B\" \"C\" \"D\" \"E\" \"F\" \"G\" \"H\" \"I\" \"J\" \"K\" \"L\" \"M\" \"N\" \"O\" \"P\" \"Q\" \"R\" \"S\" \"T\" \"U\" \"V\" \"W\" \"X\" \"Y\" \"Z\"<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>quote: returns it&#8217;s argument (an expression) as is; variables would be filled in later substitute: the same, except, variables from the environment are referenced expr: superficially, the documentation makes it sounds the same as quote. However, a major difference &#8211; you can build larger arguments. To prevent evaluation of calls, put in !! operator:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[450],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6694"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=6694"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6694\/revisions"}],"predecessor-version":[{"id":6695,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6694\/revisions\/6695"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=6694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=6694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=6694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}