diff --git a/.github/workflows/run-r-script.yml b/.github/workflows/run-r-script.yml new file mode 100644 index 0000000000..cbcd34d9bd --- /dev/null +++ b/.github/workflows/run-r-script.yml @@ -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 diff --git a/README_Running_R_Script.md b/README_Running_R_Script.md new file mode 100644 index 0000000000..81e7ba301d --- /dev/null +++ b/README_Running_R_Script.md @@ -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')" +``` diff --git a/_config.yml b/_config.yml index fb6e996934..cbd52621ad 100644 --- a/_config.yml +++ b/_config.yml @@ -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: diff --git a/writingCode.r b/writingCode.r new file mode 100644 index 0000000000..72e39bc753 --- /dev/null +++ b/writingCode.r @@ -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") \ No newline at end of file