This project is a web-based R REPL (Read-Eval-Print Loop) built using WebR. It allows users to execute R code directly in the browser, upload CSV files for analysis, and generate plots dynamically.
Current version is hosted at: https://webr-test2.netlify.app
-
Run R Code Directly in Browser:
- A simple interface to input R commands and view the results
-
Upload CSV Files:
- Upload CSV files for analysis in R
- Automatically detects and parses date strings (e.g.,
YYYY-MM-DD)
-
Generate Plots:
- Generate and display PNG plots based on the uploaded data
- Automatically handles numeric and date-based data
-
Responsive Design:
- The interface adjusts to fit various screen sizes
-
Modern Browser:
- Ensure your browser supports WebAssembly (WASM) and ES6 modules (e.g., Chrome, Firefox, Edge)
-
Hosting:
- Use a local development server or a hosting platform like Netlify to serve the files, as Cross-Origin Isolation is required for WebR
- Clone this repository:
git clone https://github.com/yourusername/webr-repl.git
cd webr-repl- Start a local server:
python3 -m http.server- Open
http://localhost:8000in your browser
- Enter any valid R code (e.g.,
1 + 1,summary(cars)) in the input box and click "Run"
- Click the "Choose File" button and upload a
.csvfile (e.g.,temperature_data.csv)
After uploading a file:
- Click "Display Head" to view the first few rows of the dataset
- Click "Create Plot" to generate a PNG plot of the data
The generated plot will appear as an image below the REPL output
Here's an example CSV file you can use to test the application:
Date,Temperature
2025-01-01,3.2
2025-01-02,4.1
2025-01-03,2.8
2025-01-04,3.5
2025-01-05,4.0
2025-01-06,3.9
2025-01-07,5.2Provides the interface for:
- Inputting R code
- Uploading CSV files
- Displaying results and plots
-
WebR Initialization:
- Initializes WebR for running R code in the browser
-
File Handling:
- Processes uploaded CSV files and passes them to R
-
Plotting:
- Generates and displays PNG plots using the R
png()function
- Generates and displays PNG plots using the R
-
Error Handling:
- Provides detailed error messages for debugging invalid inputs or unsupported operations
-
Cross-Origin Isolation:
- Ensure the project is served from a properly configured server to enable WebR functionality
-
File Size Limits:
- Large CSV files may take longer to process or fail due to memory limitations in the browser
-
Dynamic Column Selection:
- Allow users to select specific columns for plotting
-
Support for Additional File Formats:
- Expand support to
.txtand.jsonfiles
- Expand support to
-
Improved Plot Customization:
- Add user controls for customizing plot aesthetics (e.g., colors, labels)
-
Persistent State:
- Cache uploaded files in the browser for reuse
- Fork the repository
- Create a new branch (
git checkout -b feature-name) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature-name) - Open a pull request
This project is licensed under the MIT License. See the LICENSE file for details.