Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.
Merged
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
10 changes: 6 additions & 4 deletions containers/r/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# R version: latest, ... , 4.0.3
ARG VARIANT="latest"
# R version: 4, 4.1, 4.0
ARG VARIANT="4"
FROM rocker/r-ver:${VARIANT}

# Use the [Option] comment to specify true/false arguments that should appear in VS Code UX
Expand Down Expand Up @@ -32,10 +32,12 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
httpgd \
&& rm -rf /tmp/downloaded_packages

# VSCode R Debugger dependency, install the latest release version from GitHub.
RUN Rscript -e 'remotes::install_github("ManuelHentschel/vscDebugger@*release", dependencies = FALSE)'

# R Session watcher settings.
# See more details: https://github.com/REditorSupport/vscode-R/wiki/R-Session-watcher
RUN echo 'source(file.path(Sys.getenv("HOME"), ".vscode-R", "init.R"))' >> ${R_HOME}/etc/Rprofile.site \
&& echo 'options(vsc.use_httpgd = TRUE)' >> ${R_HOME}/etc/Rprofile.site
RUN echo 'source(file.path(Sys.getenv("HOME"), ".vscode-R", "init.R"))' >> ${R_HOME}/etc/Rprofile.site

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update \
Expand Down
8 changes: 5 additions & 3 deletions containers/r/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"name": "R (Community)",
"build": {
"dockerfile": "Dockerfile",
// Update VARIANT to pick a specific R version: latest, ... , 4.0.3
"args": { "VARIANT": "latest" }
// Update VARIANT to pick a specific R version: 4, 4.1, 4.0
"args": { "VARIANT": "4" }
},

// Set *default* container specific settings.json values on container create.
"settings": {
"r.rterm.linux": "/usr/local/bin/radian",
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"[r]": {
"editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
},
Expand All @@ -23,7 +24,8 @@

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ikuyadeu.r"
"ikuyadeu.r",
"rdebugger.r-debugger"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
6 changes: 3 additions & 3 deletions containers/r/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ This definition includes some test code that will help you verify it is working
1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine.
2. Clone this repository.
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4. Select the `containers/R` folder.
5. After the folder has opened in the container, you should see the R version printed in the terminal.
6. Now open the `test-project/sample.R` and press <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd> to run the script.
4. Select the `containers/r` folder.
5. Open the `test-project/hello.R` and press the "Run Source" icon displayed in the upper right (or <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd> key) to run the code.
6. You should see "Hello, remote world!" in a terminal window after the program executes.

## License

Expand Down
10 changes: 10 additions & 0 deletions containers/r/test-project/hello.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

say_hello <- function(name) {
message(paste0("Hello, ", name, "!"))
}

say_hello("remote world")
4 changes: 0 additions & 4 deletions containers/r/test-project/sample.R

This file was deleted.