相关疑难解决方法(0)

bind_rows_(x,.id)出错:参数1必须在purrr中使用map_df

我正在使用spotifyr包来抓取我的数据集中特定专辑的每首歌曲的音频功能.我的问题是我的数据集包含一些不在spotify上的艺术家 - 所以他们不应该返回任何值.

我的问题是,当我找到一个不在spotify上的艺术家时,我收到了这个错误:

Error in bind_rows_(x, .id) : Argument 1 must have names
Run Code Online (Sandbox Code Playgroud)

我已经尝试将函数包装在tryCatch中以获取NA有问题的行的每一列,但它似乎不起作用.

这是我的代码示例(仅供参考,您需要从spotify的网站获取API访问以运行spotifyr代码)

library(readr)
library(spotifyr)
library(dplyr)
library(purrr)

Sys.setenv(SPOTIFY_CLIENT_ID = "xxx") #xxx will be from spotify's website
Sys.setenv(SPOTIFY_CLIENT_SECRET = "xxx")
access_token <- get_spotify_access_token()

artist <- c("Eminem", "Chris Stapleton", "Brockhampton", "Big Sean, Metro Boomin")
album <- c("Revival", "From A Room: Volume 2", "SATURATION III", "Double or Nothing")
mydata <- data_frame(artist, album)

get_album_data <- function(x) {
  get_artist_audio_features(mydata$artist[x], return_closest_artist = TRUE) %>%
    filter(album_name == mydata$album[x])}

try_get_album_data <- function(x) { …
Run Code Online (Sandbox Code Playgroud)

error-handling r dplyr purrr

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

使用 R 在 Firefox 中创建当前打开的 URL 的向量

我想使用 R 来提取当前在 Web 浏览器中打开的所有 URL。考虑以下示例:

如何从 R 中提取这两个 URL,以获得以下输出?

my_urls <- c("https://www.google.de/", "https://www.amazon.com/")
my_urls
### [1] "https://www.google.de/"  "https://www.amazon.com/"
Run Code Online (Sandbox Code Playgroud)

经过一些研究,我怀疑这可能与RSelenium 包有关,但不幸的是我无法找出合适的 R 代码。

firefox r

5
推荐指数
1
解决办法
187
查看次数

标签 统计

r ×2

dplyr ×1

error-handling ×1

firefox ×1

purrr ×1