Call Datamuse API and return data.

datamuse_api(path, limit = 10)

Arguments

path

path to append to Datamuse API endpoint.

limit

number of results to limit the API response to.

Value

data returned from API call.

Examples

datamuse_api("/words?rel_rhy=test")
#> $content
#>        word score numSyllables
#> 1  manifest  2995            3
#> 2      best  2743            1
#> 3      rest  2366            1
#> 4   request  2328            2
#> 5   suggest  1987            2
#> 6     quest  1818            1
#> 7    attest  1754            2
#> 8     crest  1732            1
#> 9      nest  1661            1
#> 10     lest  1632            1
#> 
#> $path
#> [1] "/words?rel_rhy=test&max=10"
#> 
#> $response
#> Response [https://api.datamuse.com/words?rel_rhy=test&max=10]
#>   Date: 2022-12-25 23:49
#>   Status: 200
#>   Content-Type: application/json
#>   Size: 475 B
#> 
#> 
#> attr(,"class")
#> [1] "datamuse_api"

datamuse_api("/words?ml=test")
#> $content
#>            word    score                             tags
#> 1       try out 30045872 syn, n, results_type:primary_rel
#> 2       examine 30045525                           syn, v
#> 3         trial 30044021                      syn, adj, v
#> 4  experimental 30043762                           syn, n
#> 5   examination 30043350                           syn, n
#> 6         prove 30039620                           syn, n
#> 7         assay 30039378                           syn, n
#> 8           try 30036965                         syn, adj
#> 9          quiz 30036178                           syn, n
#> 10        essay 30023695                           syn, n
#> 
#> $path
#> [1] "/words?ml=test&max=10"
#> 
#> $response
#> Response [https://api.datamuse.com/words?ml=test&max=10]
#>   Date: 2022-12-25 23:49
#>   Status: 200
#>   Content-Type: application/json
#>   Size: 580 B
#> 
#> 
#> attr(,"class")
#> [1] "datamuse_api"