|
1 | | -# WebR ggplot2 & dplyr Demo |
| 1 | +# WebR ggplot2 Demo |
2 | 2 |
|
3 | | -A minimal Vue.js application demonstrating interactive R data visualization and manipulation using WebR, ggplot2, and dplyr in the browser. |
| 3 | +Interactive R data visualization in the browser using [WebR](https://webr.r-wasm.org/), [ggplot2](https://ggplot2.tidyverse.org/), and Vue.js. |
4 | 4 |
|
5 | | -## Features |
| 5 | +## What is it? |
6 | 6 |
|
7 | | -- 🎨 **Interactive Code Editor**: Monaco editor with R syntax highlighting |
8 | | -- 📊 **Built-in Examples**: Pre-configured examples for ggplot2 and dplyr |
9 | | -- 📁 **CSV Upload**: Drag-and-drop CSV file upload functionality |
10 | | -- 🖥️ **Real-time Output**: Live R code execution with stdout/stderr display |
11 | | -- 📈 **Plot Visualization**: SVG plot rendering in the browser |
12 | | -- 🎯 **Clean Architecture**: Well-organized Vue 3 components with TypeScript |
| 7 | +A web application that runs R code directly in your browser - no server required. Features live code editing, CSV upload, and interactive plots. |
13 | 8 |
|
14 | | -## Tech Stack |
15 | | - |
16 | | -- **Vue 3** with TypeScript |
17 | | -- **Vite** for build tooling |
18 | | -- **WebR** for R in the browser |
19 | | -- **Monaco Editor** for code editing |
20 | | -- **ESLint** with strict rules |
21 | | -- **Prettier** for code formatting |
22 | | -- **pnpm** for package management |
23 | | - |
24 | | -## Quick Start |
| 9 | +## License |
25 | 10 |
|
26 | | -1. **Install dependencies**: |
27 | | - ```bash |
28 | | - pnpm install |
29 | | - ``` |
| 11 | +MIT License |
30 | 12 |
|
31 | | -2. **Run development server**: |
32 | | - ```bash |
33 | | - pnpm dev |
34 | | - ``` |
| 13 | +## Author |
35 | 14 |
|
36 | | -3. **Build for production**: |
37 | | - ```bash |
38 | | - pnpm build |
39 | | - ``` |
| 15 | +Developed by [Piotr Migdal](https://p.migdal.pl/) from [Quesma](https://quesma.com/) |
40 | 16 |
|
41 | | -## Usage |
| 17 | +## Installation |
42 | 18 |
|
43 | | -1. **Select Examples**: Choose from pre-built examples in the dropdown |
44 | | -2. **Upload CSV**: Drag and drop CSV files or click to browse |
45 | | -3. **Edit Code**: Use the Monaco editor to write R code |
46 | | -4. **Run Code**: Click "Run Code" to execute R scripts |
47 | | -5. **View Results**: See output, plots, and any errors in the output panel |
| 19 | +Prerequisites: |
| 20 | +- Node.js 18+ |
| 21 | +- [pnpm](https://pnpm.io/) |
48 | 22 |
|
49 | | -## Example Scripts |
| 23 | +```bash |
| 24 | +# Clone repository |
| 25 | +git clone https://github.com/QuesmaOrg/demo-webr-ggplot.git |
| 26 | +cd demo-webr-ggplot |
50 | 27 |
|
51 | | -- **Basic ggplot2**: Simple scatter plot with mtcars dataset |
52 | | -- **dplyr filtering**: Data manipulation and summarization |
53 | | -- **Enhanced scatter plot**: Color mapping and trend lines |
54 | | -- **Bar chart**: Grouped bar charts with custom styling |
55 | | -- **CSV template**: Template for working with uploaded data |
| 28 | +# Install dependencies |
| 29 | +pnpm install |
56 | 30 |
|
57 | | -## Project Structure |
| 31 | +# Start development server |
| 32 | +pnpm dev |
58 | 33 |
|
| 34 | +# Build for production |
| 35 | +pnpm build |
59 | 36 | ``` |
60 | | -src/ |
61 | | -├── components/ # Vue components |
62 | | -│ ├── CodeEditor.vue # Monaco editor wrapper |
63 | | -│ ├── FileUpload.vue # CSV upload component |
64 | | -│ ├── ExampleSelector.vue # Example dropdown |
65 | | -│ └── OutputDisplay.vue # Results display |
66 | | -├── composables/ # Vue composables |
67 | | -│ └── useWebR.ts # WebR integration logic |
68 | | -├── data/ # Static data |
69 | | -│ └── examples.ts # R code examples |
70 | | -├── types/ # TypeScript types |
71 | | -│ └── index.ts # Type definitions |
72 | | -├── App.vue # Main application |
73 | | -├── main.ts # Application entry point |
74 | | -└── style.css # Global styles |
75 | | -``` |
76 | | - |
77 | | -## Development |
78 | 37 |
|
79 | | -- **Linting**: `pnpm lint` |
80 | | -- **Formatting**: `pnpm format` |
81 | | -- **Type checking**: `pnpm build` (includes vue-tsc) |
82 | | - |
83 | | -## WebR Configuration |
84 | | - |
85 | | -The application uses WebR with the following packages pre-installed: |
86 | | -- `ggplot2` for data visualization |
87 | | -- `dplyr` for data manipulation |
88 | | - |
89 | | -WebR is configured with CORS headers and proper service worker setup for browser compatibility. |
90 | | - |
91 | | -## Contributing |
| 38 | +## Usage |
92 | 39 |
|
93 | | -1. Follow the existing code style (ESLint + Prettier) |
94 | | -2. Use TypeScript for type safety |
95 | | -3. Keep components small and focused |
96 | | -4. Add examples for new R functionality |
| 40 | +1. Open http://localhost:5173 in your browser |
| 41 | +2. Select an example or write your own R code |
| 42 | +3. Upload CSV files via drag & drop |
| 43 | +4. Click "Run Code" to execute |
97 | 44 |
|
98 | | -## License |
| 45 | +## Stack |
99 | 46 |
|
100 | | -MIT License - feel free to use this project as a starting point for your own WebR applications. |
| 47 | +- [WebR](https://webr.r-wasm.org/) - R in WebAssembly |
| 48 | +- [Vue 3](https://vuejs.org/) + TypeScript |
| 49 | +- [Vite](https://vitejs.dev/) - Build tool |
| 50 | +- [Monaco Editor](https://microsoft.github.io/monaco-editor/) - Code editor |
0 commit comments