IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Playing with webr

    Michael发表于 2024-01-29 22:00:00
    love 0
    [This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

    A photo of an Impala browsing a tree

    Impala (Aepyceros melampus) female browsing Weeping Boer-Bean (Schotia brachypetala) leaves – CC-BY-SA by Bernard DUPONT

    webr allows R to run in the browser. Let’s play!

    Add webr to your quarto environment, in the terminal:

    quarto add coatless/quarto-webr

    Then, in the YAML header, add:

    engine: knitr
    filters: 
      - "webr"
    webr:
      packages:
        - "ggplot2"
        - "dplyr"
        - "duckdb"
        - "glue"
        - "ggokabeito"

    Now enclose your chunks with {webr-r} instead of {r}.

    {dplyr} is a large package, so installing/loading it can take a little time…

    … should work.

    However we can’t INSTALL (yet) a DuckDB extension:

    So we download and use a local copy of the popular french baby names:

    How does it look like?

    Get the 2022 top 9 most popular names and check their past evolution:

    Some were already very popular a long time ago. Half are recent. Names are now much more diluted.

    To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Continue reading: Playing with webr


沪ICP备19023445号-2号
友情链接