{"id":853,"date":"2025-09-04T09:06:40","date_gmt":"2025-09-04T09:06:40","guid":{"rendered":"http:\/\/www.lexique.org\/?page_id=853"},"modified":"2025-09-04T09:06:41","modified_gmt":"2025-09-04T09:06:41","slug":"how-to-query-lexique-using-r","status":"publish","type":"page","link":"http:\/\/www.lexique.org\/?page_id=853&lang=en","title":{"rendered":"How to query Lexique using R"},"content":{"rendered":"\n<p>The graphical interface for consulting the tables only allows simple filtering operations. For certain manipulations, it is more appropriate to use a script. Our document <a href=\"https:\/\/github.com\/chrplr\/openlexicon\/blob\/master\/documents\/Interroger-Lexique-avec-R\/interroger-lexique-avec-R.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">&#8220;Querying Lexique with R&#8221;<\/a> provides detailed information and search examples using the R language.<br>For example, to search for a list of words, although it is possible to use a regular expression (e.g., <code>sheep|cat|dog<\/code>) in the graphical interface, it is more efficient to use R\u2019s <code>subset<\/code> function:<br><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>If you do not already have them, you need to install <a rel=\"noreferrer noopener\" aria-label=\"R (opens in a new tab)\" href=\"https:\/\/cran.r-project.org\/\" target=\"_blank\">R<\/a> and <a rel=\"noreferrer noopener\" aria-label=\"R-Studio Desktop (opens in a new tab)\" href=\"https:\/\/www.rstudio.com\" target=\"_blank\">R-Studio Desktop<\/a>. <\/li><li>Start RStudio and then copy the following lines into the console (bottom-left window):<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>\n   source('https:\/\/raw.githubusercontent.com\/chrplr\/openlexicon\/master\/datasets-info\/fetch_datasets.R')\n\nlexique &lt;- get_lexique383_rds()\n\n    items &lt;- c('boat', 'plane', 'house', 'tree')\n\n    selection &lt;- subset(lexique, ortho %in% items)\n\n    head(selection)\n\n    write_tsv(selection, 'selection.tsv')\n<\/code><\/pre>\n\n\n\n<p>Note: the connection may be too slow to load the table, in which case you should download it to your computer and follow the instructions provided in <a href=\"https:\/\/github.com\/chrplr\/openlexicon\/blob\/master\/documents\/Interroger-Lexique-avec-R\/interroger-lexique-avec-R.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">&#8220;Querying Lexique with R&#8221;<\/a>.<br><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><br><\/p>\n\n\n\n<p><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>The graphical interface for consulting the tables only allows simple filtering operations. For certain manipulations, it is more appropriate to use a script. Our document &#8220;Querying Lexique with R&#8221; provides detailed information and search examples using the R language.For example, to search for a list of words, although it is possible to use a regular [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":841,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-853","page","type-page","status-publish","hentry","post-preview"],"_links":{"self":[{"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/pages\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lexique.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=853"}],"version-history":[{"count":1,"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/pages\/853\/revisions"}],"predecessor-version":[{"id":854,"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/pages\/853\/revisions\/854"}],"up":[{"embeddable":true,"href":"http:\/\/www.lexique.org\/index.php?rest_route=\/wp\/v2\/pages\/841"}],"wp:attachment":[{"href":"http:\/\/www.lexique.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}