Installation and Interface of R

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
 
(34 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{construction}}
 +
==Download '''R'''==
 +
As mentioned in [[Introduction to R]], '''R''' is a free software, which can be
 +
downloaded at [http://www.r-project.org/ R-Project].
  
As mentioned in [[Introduction to R]], \textsf{R} is a free software, which can be
+
==Versions of '''R'''==
downloaded at \url{http://www.r-project.org/}. \textsf{R} community is  
+
'''R''' community is very dynamic, and therefore it is quite common that several versions are  
very dynamic, and therefore it is quite common that several versions are  
+
launched in the same year. Updating the '''R''' version is as easy as  
launched in the same year. Updating the \textsf{R} version is as easy as  
+
 
download the new version in the URL provided above and install it. The  
 
download the new version in the URL provided above and install it. The  
 
installation of the new versions is not overwritten over the old  
 
installation of the new versions is not overwritten over the old  
 
version, that is why it is possible to use in your computer as many  
 
version, that is why it is possible to use in your computer as many  
\textsf{R} versions as you have installed. For the case of Windows, the
+
'''R''' versions as you have installed.  
software managing the \textsf{R} console is \textsf{R-Gui}, which
+
interface is shown in Figure \ref{fig:1}. \textsf{R-Gui} has all
+
functionalities of \textsf{R}, but it allows only one line of code, and
+
managing \textsf{R}-scripts is quite complicated.
+
  
\begin{figure}[h!]
+
==The '''R-Gui'''==
\centering
+
For the case of Windows, the
\includegraphics[width=100mm]{01-RConsole.jpg}
+
software managing the '''R''' console is '''R-Gui''', which
\caption{\textsf{R} console (\textsf{R-Gui} 3.0.1 64 bits version for  
+
interface is shown in [[media:01-RConsole.jpg|Figure 1]]. '''R-Gui''' has all
Windows)}
+
functionalities of '''R''', but it allows only one line of code, and
\label{fig:1}
+
managing '''R'''-scripts is quite complicated.
\end{figure}
+
[[File:01-RConsole.jpg|500px|thumb|center|''Figure 1'' '''R''' console ('''R-Gui''' 3.0.1 64 bits version for windows]]
  
As the working environment of \textsf{R-Gui} is not very user-friendly,  
+
==Interfaces==
most people use other programs to manage \textsf{R} scripts. These  
+
[[File:02-RStudio.jpg|500px|thumb|center|''Figure 2'' Interface of '''RStudio''' for Windows]]
programs are "interactive development environment" (IDE) which are  
+
As the working environment of '''R-Gui''' is not very user-friendly, most people use other programs to manage '''R''' scripts. These programs are "interactive development environment" (IDE) which are designed to maximize programmer productivity by using user-friendly interfaces while using the same programming language than '''R'''.  
designed to maximize programmer productivity by using user-friendly  
+
interfaces while using the same programming language than \textsf{R}.
+
There are many software on this respect, but perhaps the most used is
+
\textsf{RStudio}. \textsf{RStudio} is an open source IDE that can be
+
downloaded at \url{http://www.rstudio.com/}. It recognizes and run under
+
the last version of \textsf{R} installed in your computer. The interface
+
of the Windows version of \textsf{RStudio} is shown in Figure
+
\ref{fig:2}. This interface is similar to other statistical packages
+
(i.e. SAS, Matlab, etc.), with four differentiated regions: i) the
+
\textsf{R} script, ii) the \textsf{R} console, the \textsf{R} working
+
environment, and iv) the graphical output.
+
  
\begin{figure}[h!]
+
===RStudio===
\centering
+
There are many software on this respect, but perhaps the most used is '''RStudio'''. '''RStudio''' is an open source IDE that can be downloaded at [http://www.rstudio.com/ RStudio]. It recognizes and run under the last version of '''R''' installed in your computer. The interface of the Windows version of '''RStudio''' is shown in [[media:02-RStudio.jpg|Figure 2]]. This interface is similar to other statistical packages (i.e. SAS, Matlab, etc.), with four differentiated regions:
\includegraphics[width=165mm]{02-RStudio.jpg}
+
\caption{Interface of \textsf{RStudio} for Windows}
+
\label{fig:2}
+
\end{figure}
+
  
The \textsf{R} script window is where the \textsf{R} code is compiled.  
+
#the '''R''' script,
The code in the script can be ran: i) on the whole (by selecting all the  
+
#the '''R''' console,
script), ii) line by line (by selecting only the line or by placing the  
+
#the '''R''' working environment, and
cursor in the correspondent line of the script), or iii) a given part of  
+
#the graphical output.
the code inside a line (by selecting such part of the code). The
+
 
selected code can be ran by pressing "Ctrl+R" or by doing click in the  
+
 
 +
The '''R''' script window is where the '''R''' code is compiled.  
 +
The code in the script can be ran:  
 +
 
 +
#on the whole (by selecting all the script),  
 +
#line by line (by selecting only the line or by placing the cursor in the correspondent line of the script), or  
 +
#a given part of the code inside a line (by selecting such part of the code).  
 +
 
 +
 
 +
The selected code can be ran by pressing "Ctrl+R" or by doing click in the  
 
"Run" button. The result of running the code will be shown either in the  
 
"Run" button. The result of running the code will be shown either in the  
\textsf{R} console or in the graphical output window. If the code  
+
'''R''' console or in the graphical output window. If the code  
includes the creation of any object, it will be listed in the \textsf{R}
+
includes the creation of any object, it will be listed in the '''R'''
 
working environment window.
 
working environment window.
  
The \textsf{R} console has the same functionalities than the  
+
The '''R''' console has the same functionalities than the  
\textsf{R-Gui}. It has only one editing line and the results of the  
+
'''R-Gui'''. It has only one editing line and the results of the  
 
calculation are displayed in the same window. The error messages and  
 
calculation are displayed in the same window. The error messages and  
 
other information related with the script running process are also shown  
 
other information related with the script running process are also shown  
in the \textsf{R} console. The code writen in the \textsf{R} console can  
+
in the '''R''' console. The code writen in the '''R''' console can  
 
be run by pressing "Enter" or "Ctrl+R", and it will not suppose any  
 
be run by pressing "Enter" or "Ctrl+R", and it will not suppose any  
change in the \textsf{R} script. That is why it is very useful for  
+
change in the '''R''' script. That is why it is very useful for  
 
testing code before implementing it to the script.
 
testing code before implementing it to the script.
  
The \textsf{R} environment window shows all the objects that was created  
+
The '''R''' environment window shows all the objects that was created  
in \textsf{R} and that are active to be used. It provides a quick  
+
in '''R''' and that are active to be used. It provides a quick  
 
overview of not only the number and name of the objects in the working  
 
overview of not only the number and name of the objects in the working  
 
environment, but also about the information stored and the type of the  
 
environment, but also about the information stored and the type of the  
Line 75: Line 68:
 
install new packages and libraries not included in the core files.
 
install new packages and libraries not included in the core files.
  
To complete the exercises detailed hereinafter, \textsf{R} and  
+
To complete the exercises detailed hereinafter, '''R''' and  
\textsf{RStudio} (by this order) must be installed in your computer. In  
+
'''RStudio''' (by this order) must be installed in your computer. In  
 
the installation process, the architecture of your processor (32 or 64  
 
the installation process, the architecture of your processor (32 or 64  
 
bit) must be considered.
 
bit) must be considered.
 +
 +
 +
[[Category:Introduction to R]]

Latest revision as of 09:55, 23 April 2015

Construction.png sorry: 

This section is still under construction! This article was last modified on 04/23/2015. If you have comments please use the Discussion page or contribute to the article!

Contents

[edit] Download R

As mentioned in Introduction to R, R is a free software, which can be downloaded at R-Project.

[edit] Versions of R

R community is very dynamic, and therefore it is quite common that several versions are launched in the same year. Updating the R version is as easy as download the new version in the URL provided above and install it. The installation of the new versions is not overwritten over the old version, that is why it is possible to use in your computer as many R versions as you have installed.

[edit] The R-Gui

For the case of Windows, the software managing the R console is R-Gui, which interface is shown in Figure 1. R-Gui has all functionalities of R, but it allows only one line of code, and managing R-scripts is quite complicated.

Figure 1 R console (R-Gui 3.0.1 64 bits version for windows

[edit] Interfaces

Figure 2 Interface of RStudio for Windows

As the working environment of R-Gui is not very user-friendly, most people use other programs to manage R scripts. These programs are "interactive development environment" (IDE) which are designed to maximize programmer productivity by using user-friendly interfaces while using the same programming language than R.

[edit] RStudio

There are many software on this respect, but perhaps the most used is RStudio. RStudio is an open source IDE that can be downloaded at RStudio. It recognizes and run under the last version of R installed in your computer. The interface of the Windows version of RStudio is shown in Figure 2. This interface is similar to other statistical packages (i.e. SAS, Matlab, etc.), with four differentiated regions:

  1. the R script,
  2. the R console,
  3. the R working environment, and
  4. the graphical output.


The R script window is where the R code is compiled. The code in the script can be ran:

  1. on the whole (by selecting all the script),
  2. line by line (by selecting only the line or by placing the cursor in the correspondent line of the script), or
  3. a given part of the code inside a line (by selecting such part of the code).


The selected code can be ran by pressing "Ctrl+R" or by doing click in the "Run" button. The result of running the code will be shown either in the R console or in the graphical output window. If the code includes the creation of any object, it will be listed in the R working environment window.

The R console has the same functionalities than the R-Gui. It has only one editing line and the results of the calculation are displayed in the same window. The error messages and other information related with the script running process are also shown in the R console. The code writen in the R console can be run by pressing "Enter" or "Ctrl+R", and it will not suppose any change in the R script. That is why it is very useful for testing code before implementing it to the script.

The R environment window shows all the objects that was created in R and that are active to be used. It provides a quick overview of not only the number and name of the objects in the working environment, but also about the information stored and the type of the object.

The graphical output window is where the graphs are represented as default. Nevertheless, the figures can also be represented in external devices by request. In this window the help about the core functions or the implemented in each library is displayed. This window allows also to install new packages and libraries not included in the core files.

To complete the exercises detailed hereinafter, R and RStudio (by this order) must be installed in your computer. In the installation process, the architecture of your processor (32 or 64 bit) must be considered.

Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export