小编Dan*_*lle的帖子

使用带有R的httr包的oauth2.0令牌

问题

该包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)

curl r oauth oauth-2.0 httr

6
推荐指数
1
解决办法
3667
查看次数

r markdown输出为pdf:停止将代码块分解

我正在将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)

pdf plot r r-markdown

2
推荐指数
1
解决办法
1419
查看次数

标签 统计

r ×2

curl ×1

httr ×1

oauth ×1

oauth-2.0 ×1

pdf ×1

plot ×1

r-markdown ×1