r - 准备要传递给curlPerform的字符串

标签 r

R 在内部保存这个字符串

SOAPAction='"http://www.soaplite.com/Demo#hi"'

像这样:

"\"https://hera.api.madgeniuses.net/pixiSBB/pixiWebLogin\""

如何动态创建这样的字符串? 我用过

call = "Demo#hi"
SOAPAction = paste('"','http://www.soaplite.com/',call,'"',sep="")

问题 有更好的方法来做到这一点吗?例如 shQuote 的类比?

这有什么用? 在本次 RCurl 教程中:http://www.omegahat.org/RCurl/philosophy.html

curlPerform(url="http://services.soaplite.com/hibye.cgi",
            httpheader=c(Accept="text/xml", Accept="multipart/*", 
            SOAPAction='"http://www.soaplite.com/Demo#hi"',
                         'Content-Type' = "text/xml; charset=utf-8"),
            postfields=body,
            verbose = TRUE
           )

这样的字符串被传递到 SOAPAction。我想动态创建这个字符串。

最佳答案

我喜欢使用sprintf:

SOAPAction <- sprintf('"http://www.soaplite.com/%s"', call)

关于r - 准备要传递给curlPerform的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23163955/

相关文章:

c++ - 从 C++ 调用 R 函数

r - 如何根据 R 中的日期获取标准的计数表

r - 在 R 中创建自定义因子

随机森林 : Does it make any difference if the test-set is also labeled?

r - 如何将裸元素列表传递给 tidyeval 绘图函数,该函数接受裸元素到 purrr map

r - 在 R 中为堆叠直方图创建条形边框

将长整形为宽并保留重复的行

r - 为什么 as_tibble() 将 float 四舍五入到最接近的整数?

r - 将 Bibtex 类对象转换为针对每个引文格式化的一系列文本字符串

r - 使用从变量中选择的列名逐行索引数据帧