Я получаю сообщение об ошибке, когда я запускаю последнюю строку этого кода
# Load relevant packages
library("httr")
library("XML")
library("stringr")
library("ggplot2")
# Define image source
img.url = 'https://www.whitehouse.gov/sites/whitehouse.gov/files/images/first-family/44_barack_obama[1].jpg'
# Define Microsoft API URL to request data
URL.emoface = 'https://westus.api.cognitive.microsoft.com/emotion/v1.0/recognize'
# Define access key (access key is available via: https://www.microsoft.com/cognitive-services/en-us/emotion-api)
emotionKEY = 'xxx'
# Define image
mybody = list(url = img.url)
# Request data from Microsoft
faceEMO = POST(
url = URL.emoface,
content_type('application/json'), add_headers(.headers = c('Ocp-Apim-Subscription-Key' = emotionKEY)),
body = mybody,
encode = 'json'
)
# Show request results (if Status=200, request is okay)
faceEMO
# Reuqest results from face analysis
Obama = httr::content(faceEMO)[[1]]
Obama
# Define results in data frame
o<-as.data.frame(as.matrix(Obama$scores))
Ошибка, которую я получаю после запуска o: ошибка в Обаме $ Score: $ оператор недопустим для атомных векторов