R: Difference between revisions

Jump to navigation Jump to search
171 bytes added ,  7 years ago
Marked this version for translation
No edit summary
(Marked this version for translation)
Line 3: Line 3:
<translate>
<translate>


<!--T:1-->
"R is a system for statistical computation and graphics. It consists of a language plus a run-time environment with graphics, a debugger, access to certain system functions, and the ability to run programs stored in script files."  
"R is a system for statistical computation and graphics. It consists of a language plus a run-time environment with graphics, a debugger, access to certain system functions, and the ability to run programs stored in script files."  


<!--T:2-->
Even though R was not developed for high performance computing (HPC), its popularity with scientists from a variety of disciplines, including engineering, mathematics, statistics, bioinformatics, etc. makes it an essential tool on HPC installations dedicated to academic research. Features such as C extensions, byte-compiled code and parallelisation allow for reasonable performance in single-node jobs. Thanks to R’s modular nature, users can customize the R functions available to them by installing packages from the Comprehensive R Archive Network ([https://cran.r-project.org/ CRAN]) into their home directories.
Even though R was not developed for high performance computing (HPC), its popularity with scientists from a variety of disciplines, including engineering, mathematics, statistics, bioinformatics, etc. makes it an essential tool on HPC installations dedicated to academic research. Features such as C extensions, byte-compiled code and parallelisation allow for reasonable performance in single-node jobs. Thanks to R’s modular nature, users can customize the R functions available to them by installing packages from the Comprehensive R Archive Network ([https://cran.r-project.org/ CRAN]) into their home directories.


== The R interpreter ==
== The R interpreter == <!--T:3-->
You need to begin by loading an R module; there will typically be several versions available and you can see a list of all of them using the command  
You need to begin by loading an R module; there will typically be several versions available and you can see a list of all of them using the command  
{{Command
{{Command
Line 25: Line 27:
Platform: x86_64-pc-linux-gnu (64-bit)
Platform: x86_64-pc-linux-gnu (64-bit)


<!--T:4-->
R is free software and comes with ABSOLUTELY NO WARRANTY.
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Type 'license()' or 'licence()' for distribution details.


   Natural language support but running in an English locale
   <!--T:5-->
Natural language support but running in an English locale


<!--T:6-->
R is a collaborative project with many contributors.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
'citation()' on how to cite R or R packages in publications.


<!--T:7-->
Type 'demo()' for some demos, 'help()' for on-line help, or
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Type 'q()' to quit R.


<!--T:8-->
> values <- c(3,5,7,9)
> values <- c(3,5,7,9)
> values[0]
> values[0]
Line 46: Line 53:
To execute R scripts, use the <tt>Rscript</tt> front-end with the file containing the R commands as an argument:
To execute R scripts, use the <tt>Rscript</tt> front-end with the file containing the R commands as an argument:


<!--T:9-->
{{Command|Rscript computation.R}}
{{Command|Rscript computation.R}}


<!--T:10-->
This front-end will automatically pass scripting-appropriate options <tt>--slave</tt> and <tt>--no-restore</tt> to the R interpreter. These also imply the <tt>--no-save</tt> option, preventing the creation of useless workspace files on exit.
This front-end will automatically pass scripting-appropriate options <tt>--slave</tt> and <tt>--no-restore</tt> to the R interpreter. These also imply the <tt>--no-save</tt> option, preventing the creation of useless workspace files on exit.


== Installing R packages ==
== Installing R packages == <!--T:11-->
To install packages from [https://cran.r-project.org/ CRAN], you can use the <tt>install.packages</tt> facility inside the R interpreter. For example, to install the <tt>sp</tt> package that provides classes and methods for spatial data, use the following command on a login node:
To install packages from [https://cran.r-project.org/ CRAN], you can use the <tt>install.packages</tt> facility inside the R interpreter. For example, to install the <tt>sp</tt> package that provides classes and methods for spatial data, use the following command on a login node:


<!--T:12-->
{{Command
{{Command
|R
|R
Line 60: Line 70:
}}
}}


<!--T:13-->
When asked, select an appropriate mirror for download. Ideally, it will be geographically close to the cluster you're working on.
When asked, select an appropriate mirror for download. Ideally, it will be geographically close to the cluster you're working on.


<!--T:14-->
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.
Some packages require defining the environment variable <tt>TMPDIR</tt> before installing.


<!--T:15-->
To install a package that you downloaded (i.e. not from CRAN), you can install it the following way. Assuming the package is named <tt>archive_package.tgz</tt>, run the following command in a shell:
To install a package that you downloaded (i.e. not from CRAN), you can install it the following way. Assuming the package is named <tt>archive_package.tgz</tt>, run the following command in a shell:
{{Command
{{Command
rsnt_translations
58,180

edits

Navigation menu