Skip to content

Commit

Permalink
mv file
Browse files Browse the repository at this point in the history
rdnajac committed Sep 13, 2024
1 parent f8eb8d4 commit 3f8aada
Showing 4 changed files with 44 additions and 68 deletions.
101 changes: 36 additions & 65 deletions docs/Software/R.md
Original file line number Diff line number Diff line change
@@ -2,47 +2,29 @@

## Overview

- **R**: A programming language and environment for statistical computing and graphics.
- **RStudio**: An integrated development environment (IDE) for R, providing a console, syntax-highlighting editor, and tools for plotting, debugging, and workspace management.
- **RStudio Server**: A version of RStudio that runs on a remote server and is accessed through a web browser, ideal for cloud-based or shared computing environments.
R is a programming language and environment for statistical computing and graphics. RStudio is an integrated development environment (IDE) for R, providing a console, syntax-highlighting editor, and tools for plotting, debugging, and workspace management. RStudio Server is a version of RStudio that runs on a remote server and is accessed through a web browser, ideal for cloud-based or shared computing environments.

## Installation

### RStudio Server on AWS EC2

To install RStudio Server on an AWS EC2 instance, you can use the following script:

```sh
sudo bash <(curl -L https://raw.githubusercontent.com/rdnajac/cbmf/main/scripts/install_RStudioServer)
```

> [!NOTE]
> The `<(curl -L "$URL")` syntax is a bash process substitution that creates a temporary file descriptor for the downloaded content.
#### Remote Installation

To install RStudio Server on a remote EC2 instance from your local machine:
Use the docker image `rocker/rstudio` to run RStudio Server in a containerized environment. You can pull the image from Docker Hub and run it with the following command:

```sh
ssh -i /path/to/private-key.pem ubuntu@ec2-public-ip 'bash -s' < /path/to/install_RStudioServer
docker run -d -p 8787:8787 -e PASSWORD=yourpasswordhere rocker/rstudio
```

## Connecting to RStudio Server

1. Find your EC2 instance's public IP address in the AWS console.
2. Ensure that inbound traffic on port 8787 is allowed in the EC2 security group settings.
3. Access RStudio Server by navigating to `http://ec2-public-ip:8787` in your web browser.
Find your EC2 instance's public IP address in the AWS console. Ensure that inbound traffic on port 8787 is allowed in the EC2 security group settings. Access RStudio Server by navigating to `http://ec2-public-ip:8787` in your web browser.

## RStudio Server Login

RStudio Server uses the underlying Linux system's user accounts. The default `ubuntu` user doesn't have a password set, so you'll need to create one:
RStudio Server uses the underlying Linux system's user accounts. The default `ubuntu` user doesn't have a password set, so create one:

```sh
sudo passwd ubuntu
```

> [!TIP]
> The RStudio Server console has elevated privileges, allowing you to run commands like `passwd` or `adduser` directly.
The RStudio Server console has elevated privileges, allowing you to run commands like `passwd` or `adduser` directly.

## Package Management

@@ -65,64 +47,53 @@ remotes::install_version("Seurat", version = "4.4.1")

renv is a package management tool for R that creates project-specific libraries, ensuring reproducibility across different environments.

#### Setting up renv
Setting up renv:

1. Install renv:
```r
install.packages("renv")
renv::init()
```

```r
install.packages("renv")
```
Using renv:

2. Initialize renv in your project:
```r
renv::init()
```
```r
install.packages("dplyr") # Install packages as usual
renv::snapshot() # Snapshot your project's state
renv::restore() # Restore your project's state on another machine
```

#### Using renv
Best practices with renv:

1. Install packages as usual. renv will track them in the project library:
- Commit `renv.lock` to version control.
- Use `renv::status()` to check for unsaved changes in your project's package list.
- Regularly update your snapshot with `renv::snapshot()`.

```r
install.packages("dplyr")
```
RStudio provides visual cues for renv usage in the "Packages" pane and access to common renv functions through the "renv" menu.

2. Snapshot your project's state:
### Troubleshooting

```r
renv::snapshot()
```
If `renv::restore()` fails, check for package conflicts and ensure necessary system libraries are installed. If `sessionInfo()` shows unexpected packages, check your `.Rprofile` for auto-loaded packages and verify you're in the correct project environment.

3. Restore your project's state on another machine:
```r
renv::restore()
```
## Interesting Facts and Advanced Topics

#### Best Practices with renv
1. R's origins: R was created by Ross Ihaka and Robert Gentleman at the University of Auckland, New Zealand, and is named after the first letter of its creators' names. [Source: R-project.org](https://www.r-project.org/about.html)

- Commit `renv.lock` to version control.
- Use `renv::status()` to check for unsaved changes in your project's package list.
- Regularly update your snapshot with `renv::snapshot()`.
2. RStudio's impact: RStudio (now Posit) has significantly contributed to R's popularity. The RStudio IDE is used by an estimated 2.5 million people worldwide. [Source: Posit](https://posit.co/about/)

### RStudio Integration
3. R in research: R is widely used in academic research. A study found that R was mentioned in over 400,000 scholarly articles between 2011-2020. [Source: IEEE Spectrum](https://spectrum.ieee.org/the-top-programming-languages-2020)

- RStudio provides visual cues for renv usage in the "Packages" pane.
- Access common renv functions through the "renv" menu in RStudio.
4. Parallel computing in R: You can leverage multi-core processors for faster computations using packages like `parallel` and `foreach`. [Source: CRAN Task View](https://cran.r-project.org/web/views/HighPerformanceComputing.html)

### Troubleshooting
5. R Markdown: This powerful tool allows you to create dynamic documents that combine code, results, and narrative text. It's excellent for reproducible research. [Source: R Markdown book](https://bookdown.org/yihui/rmarkdown/)

1. If `renv::restore()` fails:
6. Shiny: A web application framework for R that allows you to create interactive web apps directly from R. It's widely used for creating dashboards and data exploration tools. [Source: Shiny by Posit](https://shiny.posit.co/)

- Check for package conflicts.
- Ensure necessary system libraries are installed.
7. Configuring RStudio Server for multiple users: You can set up RStudio Server to support multiple users, each with their own workspace and permissions. [Source: RStudio Server Admin Guide](https://docs.posit.co/ide/server-pro/settings/server_management.html)

2. If `sessionInfo()` shows unexpected packages:
- Check your `.Rprofile` for auto-loaded packages.
- Verify you're in the correct project environment.
8. Setting up RStudio Server with SSL: For secure connections, especially important in cloud environments, you can configure RStudio Server to use SSL. [Source: RStudio Server Secure Socket Layer (SSL) Guide](https://docs.posit.co/ide/server-pro/access_and_security/ssl.html)

## Advanced Topics
9. Integrating RStudio Server with version control: RStudio Server can be integrated with Git and SVN for version control, enhancing collaboration and code management. [Source: RStudio Support - Version Control](https://support.posit.co/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN)

- Configuring RStudio Server for multiple users
- Setting up RStudio Server with SSL for secure connections
- Integrating RStudio Server with version control systems (e.g., Git)
10. R Consortium: The R Consortium, supported by the Linux Foundation, funds development of R-related projects and organizes conferences. It includes major tech companies as members. [Source: R Consortium](https://www.r-consortium.org/)

For more information, refer to the [official RStudio documentation](https://docs.rstudio.com/) and [renv documentation](https://rstudio.github.io/renv/).
For more detailed information, refer to the [official RStudio documentation](https://docs.rstudio.com/) and [renv documentation](https://rstudio.github.io/renv/).
File renamed without changes.
8 changes: 8 additions & 0 deletions docs/protocols/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Protocols

Protocols go here.

TODO:

- TREKseq
- 10x nuclei prep
3 changes: 0 additions & 3 deletions docs/scripting/index.md

This file was deleted.

0 comments on commit 3f8aada

Please sign in to comment.