Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/run-r-script.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run R script

on:
push:
branches: [ master ]
workflow_dispatch:

jobs:
run-r:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up R
uses: r-lib/actions/setup-r@v2

- name: Run writingCode.r
run: |
Rscript writingCode.r

- name: Upload outputs
uses: actions/upload-artifact@v4
with:
name: r-outputs
path: r_outputs
30 changes: 30 additions & 0 deletions README_Running_R_Script.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Running `writingCode.r`

This repository contains a small R script `writingCode.r` which demonstrates writing outputs to `r_outputs/`.

Locally
-------
Make sure R is installed on your machine. Then from the repository root:

```bash
Rscript writingCode.r
```

Outputs will be written to `r_outputs/`:
- `sample_data.csv` — example CSV
- `plot.png` — example plot
- `writingCode_output.txt` — optional if you redirect stdout

GitHub Actions
--------------
A workflow `.github/workflows/run-r-script.yml` is included and will run the script on push to `master` and upload `r_outputs/` as an artifact.

Notes
-----
If the script requires additional R packages in future, add an installation step to the workflow, for example:

```yaml
- name: Install packages
run: |
R -e "install.packages(c('ggplot2'), repos='https://cloud.r-project.org')"
```
16 changes: 8 additions & 8 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
title: Clean Blog
email: your-email@example.com
title: Niharika's Portfolio
email: nvinodjain@gmail.com
description: A Blog Theme by Start Bootstrap
author: Start Bootstrap
baseurl: "/startbootstrap-clean-blog-jekyll"
url: "https://startbootstrap.github.io"
author: Niharika Vinod Jain
baseurl: ""
url: "https://NiharikaVJain.github.io"

# Social Profiles
twitter_username: SBootstrap
github_username: StartBootstrap
facebook_username: StartBootstrap
twitter_username:
github_username:
facebook_username:
instagram_username:
linkedin_username:

Expand Down
16 changes: 16 additions & 0 deletions writingCode.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
dir.create("r_outputs", showWarnings = FALSE)
cat("Starting writingCode.r\n")

# Simple example: create a small data frame and save as CSV
df <- data.frame(x = 1:10, y = (1:10) ^ 2)
write.csv(df, file = file.path("r_outputs", "sample_data.csv"), row.names = FALSE)
cat("Wrote r_outputs/sample_data.csv\n")

# Create a basic plot and save as PNG
png(filename = file.path("r_outputs", "plot.png"), width = 600, height = 400)
plot(df$x, df$y, type = "b", col = "blue", pch = 19,
main = "Sample plot", xlab = "x", ylab = "y = x^2")
dev.off()
cat("Wrote r_outputs/plot.png\n")

cat("Done.\n")