该包httr在R中提供CURL包装(参见包文档).
我是HTTP和API的新手.我的麻烦是让oauth2.0认证工作.我尝试了各种语法规范,并获得错误或状态401.
使用oauth2.0令牌并使用GET()请求的正确方法是什么httr?
# Set UP
url = "https://canvas.{institution}.edu/api/v1/courses"
key = "{secret_key}"
# 1
GET(url, sign_oauth2.0(key))
# Error: Deprecated: supply token object to config directly
# 2
GET(url, config(sign_oauth2.0 = key))
# unknown option: sign_oauth2.0
# 3
GET(url, config = list(sign_oauth2.0 = key))
# Status 401
Run Code Online (Sandbox Code Playgroud) 我正在将r markdown文件打印为pdf。我尝试了各种输出规格,但是该图始终显示在段[1]和[2]的中间。
我希望所有代码都显示为一个块,稍后将在文档中调用该图。
```{r, include=TRUE, results='hide'}
# [1] There is code up here
# [plot interrupts the code chunk here] Scatter plot
plot1 = plot(df$var1, df$var)
# [2] More code below this point
```
Run Code Online (Sandbox Code Playgroud)