WebR – 浏览器中的 R
WebR – R in the Browser

原始链接: https://docs.r-wasm.org/webr/latest/

## WebR:浏览器中的 R WebR 使用 WebAssembly 将 R 统计语言的强大功能直接带到 Web 浏览器和 Node.js 中。与传统设置不同,它无需单独的 R 服务器——R 解释器在用户的浏览器*内*运行。 这允许进行客户端数据分析和可视化,增强 Web 应用程序的功能。关键的 R 包正在移植以供 WebR 使用,可以通过标准的 `library()` 函数访问。 目前 WebR API 正在积极开发中,因此文档可能并非始终是最新的。开发者还应注意某些浏览器(尤其是在移动设备上)施加的潜在 RAM 限制,这可能会影响大型数据集的性能。 您可以通过在线提供的交互式 REPL 演示立即体验 WebR——无需安装!

## WebR:浏览器中的R - 摘要 WebR (r-wasm.org) 使用 WebAssembly 将 R 编程语言直接带到 Web 浏览器。这使得 R 代码,包括数据分析和可视化(如 ggplot2 图表 – GitHub 上有演示),可以在客户端运行而无需服务器。 讨论强调了 WebR 在统计编程方面的优势及其独特的“计算于语言之上”功能,实现了难以在 Python 中复制的上下文和符合人体工程学的代码执行。用户设想的应用包括客户端预测工具和沙箱化 LLM 生成的代码。 虽然初始 WASM 文件大小(12MB)令人担忧,但压缩和有针对性的编译可以减小它。 类似的项目存在于其他语言中,例如 Julia (WebAssemblyCompiler.jl) 和 Jupyter (Jupyterlite-xeus 与 xeus-r 内核),利用 emscripten-forge 进行 WASM 包构建。 通过 quarto-webr 扩展,可以使用 R Markdown 文档,从而实现基于 Web 的 RStudio 笔记本编辑。
相关文章

原文

WebR is a version of the statistical language R compiled for the browser and Node.js using WebAssembly, via Emscripten.

WebR makes it possible to run R code in the browser without the need for an R server to execute the code: the R interpreter runs directly on the user’s machine. Several R packages have also been ported for use with webR, and can be loaded in the usual way using the library() function.

The webR project is under active development, and the API is subject to change. Be aware that if you are using the latest build of webR the contents of this documentation might be out of date.

Some browsers (especially mobile browsers) may place restrictive limits on the amount of RAM provided to WebAssembly regardless of the amount of memory available on the host device. Please keep this in mind when developing applications with webR intended for use on mobile devices.

Try it out

WebR REPL

Try a demo of the webR REPL directly in your web browser, no installation required!

Interactive R code editor

fit <- lm(mpg ~ am, data=mtcars) summary(fit)

联系我们 contact @ memedata.com