{"id":15195514,"url":"https://github.com/abikesa/workflow","last_synced_at":"2026-01-30T16:03:14.522Z","repository":{"id":238046906,"uuid":"795759008","full_name":"abikesa/workflow","owner":"abikesa","description":"New Workflow","archived":false,"fork":false,"pushed_at":"2024-10-10T21:13:25.000Z","size":40749,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T03:37:03.590Z","etag":null,"topics":["ipynb","python","r","stata","unix"],"latest_commit_sha":null,"homepage":"https://abikesa.github.io/workflow/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abikesa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-04T01:30:53.000Z","updated_at":"2024-10-10T21:13:23.000Z","dependencies_parsed_at":"2024-06-11T20:18:49.422Z","dependency_job_id":"f1bb8641-661c-4731-b46e-f575819ec3d7","html_url":"https://github.com/abikesa/workflow","commit_stats":{"total_commits":57,"total_committers":5,"mean_commits":11.4,"dds":0.5789473684210527,"last_synced_commit":"801228642e80c3cde2675dc3829348fc9767a812"},"previous_names":["abikesa/workflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abikesa/workflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abikesa%2Fworkflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abikesa%2Fworkflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abikesa%2Fworkflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abikesa%2Fworkflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abikesa","download_url":"https://codeload.github.com/abikesa/workflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abikesa%2Fworkflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ipynb","python","r","stata","unix"],"created_at":"2024-09-27T23:40:26.275Z","updated_at":"2026-01-30T16:03:14.503Z","avatar_url":"https://github.com/abikesa.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n```stata\nqui {\n\tcls\n\tuse ${repo}transplants, clear\n    ds, not(type string)  \n\tglobal threshold 9  \n\tputexcel set levelsof, replace \n\tlocal row=2\n    foreach v of varlist age gender race { //`r(varlist)'\n\t    levelsof `v', local(numlevels)\n\t    if r(r) == 2 {  \n\t\t\tputexcel A`row' = (\"`v'\") B`row' = (\"per\")\n\t\t\tnoi di  _col(1)    \"`v'\"  _col(30)  \"per\"\n\t\t\tlocal row = `row' + 1\n\t    }\n\t    else if inrange(`r(r)', 3, $threshold) {  \n\t\t\tputexcel A`row' = (\"`v', %\") B`row' = (\"\")\n\t\t\tnoi di   _col(1)   \"`v', %\" _col(30)   \"\"\n\t\t\tforeach l of numlist `numlevels' {\n\t\t\t\tlocal row = `row' + 1\n                putexcel A`row' = (\"    catlab\") B`row' = (\"per\")\n\t\t\t\tnoi di  _col(1)    \"    catlab\" _col(30)   \"per\"\n\t\t\t}\t\n\t    }\n\t    else {  \n\t\t\tputexcel A`row' = (\"`v'\") B`row' = (\"m_iqr\")\n\t\t\tnoi di   _col(1)   \"`v'\"  _col(30)  \"m_iqr\"\n\t\t\tlocal row = `row' + 1\n\t    }\n\t\t\n    }\n\t\n}\n\n\n```\n\nGot it. To work 100% from .ipynb files in VSCode, we need to ensure that the Jupyter server runs in the background and that the Jupyter extension in VSCode automatically connects to it. Here’s the script tailored for this workflow:\n\n### Complete Script for Setting Up Stata and R Kernels for VSCode\n\n```sh\n#!/bin/bash\n\n# Set up variables\nVENV_PATH=\"/Users/hades/Documents/hades/myenv\"\nSTATA_PATH=\"/Applications/Stata/StataMP.app/Contents/MacOS/stata-mp\"\nZSHRC_PATH=\"$HOME/.zshrc\"\n\n# Step 1: Remove existing virtual environment if it exists\necho \"Removing existing virtual environment...\"\nrm -rf $VENV_PATH\n\n# Step 2: Create a new virtual environment\necho \"Creating a new virtual environment...\"\npython3 -m venv $VENV_PATH\n\n# Step 3: Activate the virtual environment\necho \"Activating the virtual environment...\"\nsource $VENV_PATH/bin/activate\n\n# Step 4: Install necessary packages for Python\necho \"Installing necessary packages for Python...\"\npip install stata_kernel ipykernel setuptools notebook\n\n# Step 5: Configure environment variable for Stata path\necho \"Configuring environment variable for Stata path...\"\nif [ ! -f $ZSHRC_PATH ]; then\n    touch $ZSHRC_PATH\nfi\ngrep -qxF \"export STATA_KERNEL_STATA_PATH=$STATA_PATH\" $ZSHRC_PATH || echo \"export STATA_KERNEL_STATA_PATH=$STATA_PATH\" \u003e\u003e $ZSHRC_PATH\nsource $ZSHRC_PATH\n\n# Step 6: Install the Stata kernel\necho \"Installing the Stata kernel...\"\npython -m stata_kernel.install\n\n# Step 7: Install IRkernel for R\necho \"Installing IRkernel for R...\"\nRscript -e \"install.packages('IRkernel')\"\nRscript -e \"IRkernel::installspec(user = FALSE)\"\n\n# Step 8: Start Jupyter Notebook server in the background\necho \"Starting Jupyter Notebook server in the background...\"\nnohup jupyter notebook --no-browser --NotebookApp.token='' --NotebookApp.password='' \u003e jupyter.log 2\u003e\u00261 \u0026\n\n# Wait for the Jupyter server to start\nsleep 5\n\necho \"Setup complete! You can now open .ipynb files directly in VSCode and use the Stata and R kernels.\"\n```\n\n### Instructions to Use the Script\n\n1. **Save the Script**:\n   - Save the script to a file, for example, `setup_stata_r_kernel.sh`.\n\n2. **Make the Script Executable**:\n   - Make the script executable by running the following command:\n\n   ```sh\n   chmod +x setup_stata_r_kernel.sh\n   ```\n\n3. **Run the Script**:\n   - Run the script by executing:\n\n   ```sh\n   ./setup_stata_r_kernel.sh\n   ```\n\n### Explanation and How to Use in VSCode\n\n- **Step 1**: The script removes any existing virtual environment to ensure a fresh setup.\n- **Step 2**: A new virtual environment is created.\n- **Step 3**: The virtual environment is activated.\n- **Step 4**: Necessary Python packages (`stata_kernel`, `ipykernel`, `setuptools`, `notebook`) are installed.\n- **Step 5**: The environment variable for the Stata path is set up.\n- **Step 6**: The Stata kernel is installed.\n- **Step 7**: The IRkernel for R is installed.\n- **Step 8**: The Jupyter Notebook server is started in the background with no authentication required (`--NotebookApp.token='' --NotebookApp.password=''`).\n\n### Working with .ipynb Files in VSCode\n\nAfter running the script, follow these steps:\n\n1. **Open VSCode**:\n   - Open VSCode and ensure the Jupyter extension is installed.\n\n2. **Open or Create Jupyter Notebooks**:\n   - Open an existing `.ipynb` file or create a new one.\n\n3. **Select Kernel**:\n   - When you open a notebook, click on the kernel name at the top right and select the appropriate kernel (Stata or R).\n\nVSCode should automatically connect to the running Jupyter server in the background. This setup ensures that you can work entirely within VSCode, using the provided kernels without needing to interact with the browser-based Jupyter interface.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabikesa%2Fworkflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabikesa%2Fworkflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabikesa%2Fworkflow/lists"}