Autor: Jason Bryer, Ph.D. [email protected]
Site: https://jbryer.github.io/brickset/
Este pacote fornece funções para acessar dados sobre conjuntos LEGO no site do Brickset. O pacote também contém um data.frame com todos os conjuntos LEGO (n = 18.455) de 1970 a 2022. Esse conjunto de dados foi criado usando a função getSets e é recomendável que você use esse quadro de dados para reduzir o número de chamadas de API. Consulte o script Build.R sobre como o quadro de dados foi criado. As informações sobre as variáveis estão incluídas abaixo.
Você pode baixar do cran usando:
install.packages( ' brickset ' ) Ou a versão mais recente de desenvolvimento usando o pacote remotes :
remotes :: install_github( ' jbryer/brickset ' )Para usar a API do Brickset, você deve primeiro criar uma conta Brickset e solicitar uma chave da API. A documentação completa da API Bricket está disponível aqui: https://brickset.com/article/52664/api-version-3-documentation
A maioria das funções exige um nome de usuário, senha e chave de API de Brickset. Você pode passar esses parâmetros ou definir estas opções:
options( brickset_key = ' YOUR_API_KEY ' ,
brickset_username = ' YOUR_USERNAME ' ,
brickset_password = ' YOUR_PASSWORD ' ) A função checkKey verificará se sua chave da API é válida:
brickset :: checkKey()
# > [1] TRUE Você pode verificar seu uso da API com a função getKeyUsageStats .
brickset :: getKeyUsageStats()
# > dateStamp count
# > 1 2023-03-30T00:00:00Z 3
# > 2 2023-03-24T00:00:00Z 2
# > 3 2023-03-23T00:00:00Z 2
# > 4 2023-03-22T00:00:00Z 16
# > 5 2023-03-21T00:00:00Z 2 A função getSets retorna todos os conjuntos LEGO do ano fornecido.
sets2021 <- brickset :: getSets( 2021 )
head( sets2021 , n = 3 )
# > setID name year theme themeGroup
# > 1 31026 Police Station 2021 Icons Model making
# > 2 31754 Volkswagen T2 Camper Van 2021 Icons Model making
# > 3 31025 Flower Bouquet 2021 Icons Model making
# > subtheme category released pieces minifigs
# > 1 Modular Buildings Collection Normal TRUE 2923 5
# > 2 Vehicles Normal TRUE 2207 NA
# > 3 Botanical Collection Normal TRUE 756 NA
# > bricksetURL rating reviewCount packagingType
# > 1 https://brickset.com/sets/10278-1 4.4 4 Box
# > 2 https://brickset.com/sets/10279-1 4.1 0 Box
# > 3 https://brickset.com/sets/10280-1 4.3 3 Box
# > availability agerange_min US_retailPrice US_dateFirstAvailable
# > 1 LEGO exclusive 18 199.99 2021-01-02T00:00:00Z
# > 2 LEGO exclusive 18 179.99 2021-08-02T00:00:00Z
# > 3 Retail 18 59.99 2021-01-02T00:00:00Z
# > US_dateLastAvailable UK_retailPrice UK_dateFirstAvailable
# > 1 <NA> 169.99 2021-01-01T00:00:00Z
# > 2 2022-11-12T00:00:00Z 139.99 2021-08-01T00:00:00Z
# > 3 <NA> 54.99 2021-01-01T00:00:00Z
# > UK_dateLastAvailable CA_retailPrice CA_dateFirstAvailable
# > 1 <NA> 269.99 2021-01-02T00:00:00Z
# > 2 2022-11-29T00:00:00Z 249.99 2021-08-03T00:00:00Z
# > 3 <NA> 79.99 2021-01-02T00:00:00Z
# > CA_dateLastAvailable DE_retailPrice DE_dateFirstAvailable
# > 1 <NA> 199.99 2021-01-02T00:00:00Z
# > 2 2022-11-12T00:00:00Z 159.99 2021-08-02T00:00:00Z
# > 3 <NA> 59.99 2021-01-02T00:00:00Z
# > DE_dateLastAvailable height width depth weight
# > 1 <NA> 47.6 57.7 11.8 4.012
# > 2 2022-11-30T00:00:00Z 37.4 57.8 11.2 2.945
# > 3 <NA> 38.2 26.2 7.1 0.760
# > thumbnailURL
# > 1 https://images.brickset.com/sets/small/10278-1.jpg
# > 2 https://images.brickset.com/sets/small/10279-1.jpg
# > 3 https://images.brickset.com/sets/small/10280-1.jpg
# > imageURL
# > 1 https://images.brickset.com/sets/images/10278-1.jpg
# > 2 https://images.brickset.com/sets/images/10279-1.jpg
# > 3 https://images.brickset.com/sets/images/10280-1.jpg A função getReviews retornará todas as análises para um determinado conjunto.
reviews29830 <- brickset :: getReviews( 29830 )
names( reviews29830 )
# > [1] "author" "datePosted" "title"
# > [4] "review" "HTML" "overall"
# > [7] "parts" "buildingExperience" "playability"
# > [10] "valueForMoney" Os getThemes e getSubthemes retornam informações sobre os temas LEGO.
getThemes() | > head( n = 3 )
# > theme setCount subthemeCount yearFrom yearTo
# > 1 {Unknown IP} 5 0 2023 2023
# > 2 4 Juniors 24 5 2003 2004
# > 3 Action Wheelers 9 0 2000 2001
getSubthemes( ' Toy Story ' )
# > theme subtheme setCount yearFrom yearTo
# > 1 Toy Story Buildable Figures 2 2010 2010
# > 2 Toy Story Original Film 2 2010 2010
# > 3 Toy Story Toy Story 2 3 2010 2010
# > 4 Toy Story Toy Story 3 8 2010 2010
getYears( ' Toy Story ' )
# > theme year setCount
# > 1 Toy Story 2010 15 As getInstructions retornarão uma tabela com os URLs às instruções de construção.
instructions <- getInstructions( setID = 29830 )
instructions
# > URL
# > 1 https://www.lego.com/cdn/product-assets/product.bi.core.pdf/6313846.pdf
# > 2 https://www.lego.com/cdn/product-assets/product.bi.core.pdf/6313848.pdf
# > 3 https://www.lego.com/cdn/product-assets/product.bi.core.pdf/6313849.pdf
# > 4 https://www.lego.com/cdn/product-assets/product.bi.core.pdf/6313850.pdf
# > description
# > 1 BI 3103, 112+4/65+200G, 10270 V29 1/2
# > 2 BI 3103, 96+4/65+200G,10270 V29 2/2
# > 3 BI 3103, 112+4/65+200G, V39/142 1/2
# > 4 BI 3103, 96+4/65+200G, V39/142 2/2 legosets O quadro de dados legosets contém todos os conjuntos LEGO (n = 18.455) de 1970 a 2022.
data( " legosets " , package = " brickset " )
ggplot( legosets , aes( x = year )) + geom_bar() +
ggtitle( ' Number of LEGO sets by year ' ) +
xlab( ' Year ' ) + ylab( ' Number of LEGO Sets ' )
ggplot( legosets , aes( x = pieces , y = US_retailPrice )) +
geom_point() +
ggtitle( ' Cost of LEGO sets by number of pieces ' ) +
xlab( ' Number of LEGO pieces ' ) + ylab( ' US Retail Price (dollars) ' )
As variáveis no quadro de dados legosets são:
| Tipo | Exclusivo_values | |
|---|---|---|
| setid | Inteiro | 18455 |
| nome | personagem | 15372 |
| ano | Inteiro | 53 |
| tema | personagem | 154 |
| themeGroup | personagem | 16 |
| subtema | personagem | 901 |
| categoria | personagem | 7 |
| lançado | lógico | 2 |
| pedaços | Inteiro | 1403 |
| minifigs | Inteiro | 34 |
| Bricketurl | personagem | 18455 |
| avaliação | numérico | 31 |
| ReviewCount | Inteiro | 64 |
| PackagingType | personagem | 18 |
| disponibilidade | personagem | 10 |
| AgeRange_min | Inteiro | 16 |
| Us_retailprice | numérico | 142 |
| Us_datefirstavatable | Data | 881 |
| US_DATELASTAVALABLE | Data | 2125 |
| Uk_retailprice | numérico | 210 |
| Uk_datefirstavatable | Data | 825 |
| UK_DATELASTAVALABLE | Data | 1984 |
| Ca_retailPrice | numérico | 162 |
| Ca_datefirstavatable | Data | 641 |
| CA_DATELASTAVALEBLE | Data | 1808 |
| DE_RETAILPRICE | numérico | 155 |
| De_datefirstavatable | Data | 428 |
| De_datelastavailable | Data | 1176 |
| altura | numérico | 241 |
| largura | numérico | 286 |
| profundidade | numérico | 279 |
| peso | numérico | 1046 |
| Thumbnailurl | personagem | 17420 |
| imageurl | personagem | 17420 |
Observe que o projeto Brickset é lançado com um código de conduta contribuinte. Ao contribuir para este projeto, você concorda em cumprir seus termos.