ISBN을 기반으로 API (http://www.knigoed.info/api-prices.html)에서 도서 가격 데이터를 얻으려고합니다.JSON API가있는 R 루프 소스
아이디어는
isbns<- c("9785170922789", "9785170804801", "9785699834174", "9785699717255", "9785170869237")
getISBNprice <- function(ISBN, source="http://www.knigoed.info/api/Prices?code=") {
pathA <- source
for (i in 1:length(ISBN)) {
ISB <- ISBN[i]
AAA <- paste(pathA, ISB, "&sortPrice=DESC&country=RU", sep="")
document <- fromJSON(AAA, flatten = FALSE)
dfp <- document$prices
dfp <- cbind(dfp,ISB)
# dfp <- cbind(dfp,BookID=document$bookId)
# dfp <- cbind(dfp,Title=document$title)
# dfp <- cbind(dfp,Author=document$author)
# dfp <- cbind(dfp,Publisher=document$publisher)
# dfp <- cbind(dfp,Series=document$series)
# dfp <- cbind(dfp,Picture=document$picture)
if (!exists("AAAA")) {AAAA<- dfp} else {bind_rows(AAAA, dfp) }
}
AAAA
}
그러나 함수가 오류를 반환합니다 (다른 공급 업체의 가격 또는 적어도 Data.Frame) 데이터 사용 가능한 모든 정보와 프레임을 얻을 수있는 기능에 ISBN이의 벡터를 제출하는 것입니다 : 1. bind_rows_ (x, .id)에서 같지 않은 요소 수준 : 문자로 강제 변환 됨 2 : bind_rows_ (x, .id)에서 : 동일하지 않은 요소 수준 : 문자로 강제 변환 됨 3 : bind_rows_ (x, .id) : 동일하지 않은 요소 수준 : 문자로 강제 변환 4 : bind_rows_ (x, .id)에서 : 같지 않은 요소 수준 : 문자로 강제 변환
매우 명확하고 자세한 설명과 함께 완벽한 솔루션을 제공해 주셔서 감사합니다. 털이 많은 것을 배울 수 있도록 최선을 다하겠습니다. – Krank