https://wiki.archlinux.org/api.php?action=feedcontributions&user=Schestnut&feedformat=atomArchWiki - User contributions [en]2019-09-23T18:02:49ZUser contributionsMediaWiki 1.33.0https://wiki.archlinux.org/index.php?title=R&diff=217085R2012-08-08T14:51:43Z<p>Schestnut: Added instruction for Tk dependency of R Commander</p>
<hr />
<div>[[Category:Programming language]]<br />
{{stub}}<br />
<br />
''R is a free software environment for statistical computing and graphics'' (http://www.r-project.org/).<br />
<br />
== Installing R ==<br />
<br />
It is very easy to install R in Arch Linux:<br />
# pacman -S r<br />
<br />
=== Installing R packages ===<br />
There are many add-on R packages, which can be browsed on [http://cran.r-project.org/ The R Website.]. They can be installed from within R using the R install.packages command. It is not necessary to be superuser or have root privileges when doing this -- R can install its packages locally for the individual user. This is the safest way to install R packages and won't conflict with the pacman package management.<br />
<br />
== Running R ==<br />
R can be run from the command line, by using the R command:<br />
$ R<br />
<br />
== Adding a graphical frontend to R ==<br />
<br />
The linux version of R does not include a graphical user interface. However, third-party user interfaces for R are available, such as R commander and RKWard. <br />
<br />
=== R Commander frontend ===<br />
R Commander is a popular user interface to R. There is no Arch linux package available to install R commander, but it is an R package so it can be installed easily from within R. R Commander requires Tk:<br />
# pacman -S tk<br />
<br />
To install R Commander, run 'R' from the command line. Then type:<br />
> install.packages("Rcmdr", dependencies=TRUE)<br />
<br />
This can take some time.<br />
<br />
You can then start R Commander from within R using the library command:<br />
<br />
> library("Rcmdr")<br />
<br />
=== RKWard frontend ===<br />
RKWard can be installed from the Arch Linux [[AUR]], and is an open-source frontend which allows for data import and browsing as well as running common statistical tests and plots.<br />
<br />
:'''Note:''' It will be assumed that you know how to build packages from the AUR. If you have never used the AUR before, please take a look at the [[AUR_User_Guidelines|AUR User Guidelines]].<br />
<br />
First install the dependencies:<br />
# pacman -S kdelibs php qt r automoc4<br />
<br />
Then get the AUR sources and PKGBUILD file:<br />
<br />
As a user from the command line:<br />
# wget https://aur.archlinux.org/packages/rkward/PKGBUILD<br />
# wget https://aur.archlinux.org/packages/rkward/rkward.tar.gz<br />
# makepkg<br />
<br />
As root/superuser, install the package using pacman (the version may be different from 0.5.2-1, as rkward is under development).<br />
# pacman -U rkward-0.5.2-1-i686.pkg.tar.gz</div>Schestnuthttps://wiki.archlinux.org/index.php?title=SageMath&diff=211462SageMath2012-06-28T17:24:54Z<p>Schestnut: Updated CTAN link.</p>
<hr />
<div>[[Category:Mathematics and science]]<br />
[http://www.sagemath.org Sage] is a program for numerical and symbolic mathematical computation. It is meant to provide an alternative for commercial programs such as Maple, Matlab, and Mathematica. It is actually mantained in the community repository.<br />
<br />
==Installation==<br />
{{Note|With version 4.8, the package {{AUR|sage-mathematics}} has been temporarily moved back to the [[AUR]]. Consider a compile- and build-time up to 4+ hours, depending on the performance of your system.}}<br />
To install binaries from community repository:<br />
# pacman -S sage-mathematics<br />
<br />
==Usage==<br />
===Sage-Commandline===<br />
Once installed, users should be able to start the sage commandline in bash.<br />
$ sage<br />
Math can then be typed at this commandline.<br />
sage: 2+2<br />
4<br />
Note, however, that the CLI is not very comforable for certain purposed. For instance, if you plot a function,<br />
sage: plot(sin,(x,0,10))<br />
this is opened in a browser window. In these cases, you can start the notebook server by<br />
sage: notebook()<br />
<br />
===Sage-Notebook===<br />
To start the Sage-Notebook server from bash, without going thru Sage-Commandline:<br />
$ sage -n<br />
The notebook will be accessable in the browser from http://localhost:8000 , and will require you to login. However, If you are only intending to run the server for personal use, and not across the internet, the login will be an annoyance.<br />
<br />
You can instead start Sage notebook without requiring login, and have it automatically pop up in a browser.<br />
$ BROWSER="chromium" sage -c "notebook(require_login=false,open_viewer=true)"<br />
<br />
More detailed documentation can be read about the [http://www.sagemath.org/doc/reference/sagenb/notebook/notebook_object.html "notebook() command."]<br />
<br />
===Cantor===<br />
The KDE Education Project includes a package called Cantor which acts as a front-end for several pieces of mathematical software including Sage.<br />
See:<br />
[http://wiki.sagemath.org/Cantor "Sage Wiki - Cantor page"]<br />
[http://edu.kde.org/applications/mathematics/cantor/ "KDEEdu - Cantor page"]<br />
<br />
You can install it with:<br />
$ pacman -S kdeedu-cantor<br />
or along with the 'kde' or 'kdeedu' groups.<br />
<br />
===Documentation===<br />
For local Documentation, one can compile it into html or even pdfs. Apparently, this needs to be executed as root (perhaps unsafely):<br />
# sage -docbuild reference html<br />
This builds html docs for the whole tree "reference" (which is alot; Expect many many hours). An option is to build a smaller part of the documentation tree, but you would need to know what it is you want. Until then, you might consider just browsing reference online.<br />
One place this can be found is at http://www.sagemath.org/doc/ .<br />
<br />
==Optional additions==<br />
<br />
===SageTeX===<br />
If you have installed Texlive on your system, you may be interested in using SageTeX, a package that makes possible the inclusion of sage code in LaTeX files. Starting from version 4.6.1-3, Texlive is made aware of SageTeX automagically, and you can start using it straight away.<br />
<br />
As a simple example, here is how you include a Sage 2D plot in your latex document (assuming you use pdfLaTeX):<br />
* include the sagetex package in the preamble of your document with the usual<br />
\usepackage{sagetex}<br />
* create a sagesilent environment in which you insert your sage code:<br />
\begin{sagesilent}<br />
dob(x) = sqrt(x^2-1)/(x * arctan(sqrt(x^2-1)))<br />
dpr(x) = sqrt(x^2-1)/(x * log( x + sqrt(x^2-1)))<br />
p1 = plot(dob,(x,1,10),color='blue')<br />
p2 = plot(dpr,(x,1,10),color='red')<br />
ptot=p1+p2<br />
ptot.axes_labels(['$\\xi$','$\\frac{R_h}{\\max(a,b)}$'])<br />
\end{sagesilent}<br />
* create the plot e.g. inside a float environment:<br />
\begin{figure}<br />
\begin{center}<br />
\sageplot[width=\linewidth]{ptot}<br />
\end{center}<br />
\end{figure}<br />
* compile your document with the following procedure:<br />
$pdflatex <doc.tex><br />
$sage <doc.sage><br />
$pdflatex <doc.tex><br />
* you can have a look at your output document.<br />
<br />
The full documentation of SageTeX is available on [http://www.ctan.org/pkg/sagetex CTAN].<br />
<br />
====Troubleshooting====<br />
If your Texlive installation does not find the sagetex package, you can try the following procedure (do it as root, or with sudo, or use a local folder):<br />
* Copy the files to the texmf directory:<br />
# cp /opt/sage/local/share/texmf/tex/* /usr/share/texmf/tex/<br />
* Refresh Texlive:<br />
{{hc|# texhash /usr/share/texmf/|texhash: Updating /usr/share/texmf/.//ls-R... <br />
texhash: Done.}}<br />
<br />
===Additional Packages===<br />
<br />
If you need to compile your own custom packages in addition to the standard ones, you might need to install aur/sage-mathematics-spkgs so that you will have the spkgs of the original packages.</div>Schestnut