[英]Turning jquery into usable string in R
I am trying to convert the following jquery code into a string that I can pass into a function in R: 我正在尝试将以下jquery代码转换为可以传递给R中的函数的字符串:
function main() {
return join(
Events({
from_date: '2016-09-01',
to_date: '2016-12-01',
event_selectors: [{selector: 'event["event.name"]=="Page
Viewed"'}]
}),
People({
user_selectors: [{selector: 'user["Is Test"]==false'}]
}),
{type:'left'})
}
Since the query includes both single and double quotes, I can't simply wrap it in whichever one isn't present. 由于查询同时包含单引号和双引号,因此我不能简单地将其包装在任何不存在的地方。
I have tried simply wrapping it into double quotes and then using escape characters for the double quotes inside the query, as shown below: 我尝试将其包装成双引号,然后在查询中对双引号使用转义符,如下所示:
"function main() {
return join(
Events({
from_date: '2016-09-01',
to_date: '2016-12-01',
event_selectors: [{selector: 'event[\"event.name\"]==\"Page
Viewed\"'}]
}),
People({
user_selectors: [{selector: 'user[\"Is Test\"]==false'}]
}),
{type:'left'})
}"
But the problem is that when I run that string in R the escape characters actually show up, and I need to pass the original, untainted query into the 'mixpanelJQLQuery()' function in the 'RMixpanel' library. 但是问题在于,当我在R中运行该字符串时,转义字符实际上会显示出来,并且我需要将原始的,无污染的查询传递给“ RMixpanel”库中的“ mixpanelJQLQuery()”函数。
Any suggestions? 有什么建议么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.