![](https://csdnimg.cn/release/download_crawler_static/6270843/bg12.jpg)
4 Data Mining with R: Learning with Case Studies
After downloading the binary distribution for your operating system you
just need to follow the instructions that come with it. In the case of the Win-
dows version, you simply execute the downloaded file (R-2.10.1-win32.exe)
4
and select the options you want in the following menus. In some operating
systems you may need to contact your system administrator to fulfill the in-
stallation task due to lack of permissions to install software.
To run R in Windows you simply double-click the appropriate icon on your
desktop, while in Unix versions you should type R at the operating system
prompt. Both will bring up the R console with its prompt “>”.
If you want to quit R you can issue the command q() at the prompt. You
will be asked if you want to save the current workspace. You should answer yes
only if you want to resume your current analysis at the point you are leaving
it, later on.
Although the set of tools that comes with R is by itself quite powerful,
it is natural that you will end up wanting to install some of the large (and
growing) set of add-on packages available for R at CRAN. In the Windows
version this is easily done through the “Packages” menu. After connecting
your computer to the Internet you should select the “Install package from
CRAN...”option from this menu. This option will present a list of the packages
available at CRAN. You select the one(s) you want, and R will download the
package(s) and self-install it(them) on your system. In Unix versions, things
may be slightly different depending on the graphical capabilities of your R
installation. Still, even without selection from menus, the operation is simple.
5
Suppose you want to download the package that provides functions to connect
to MySQL databases. This package name is RMySQL.
6
You just need to type
the following command at R prompt:
> install.packages('RMySQL')
The install.packages() function has many parameters, among which
there is the repos argument that allows you to indicate the nearest CRAN
mirror.
7
Still, the first time you run the function in an R session, it will prompt
you for the repository you wish to use.
One thing that you surely should do is install the package associated with
this book, which will give you access to several functions used throughout the
book as well as datasets. To install it you proceed as with any other package:
> install.packages('DMwR')
4
The actual name of the file changes with newer versions. This is the name for version
2.10.1.
5
Please note that the following code also works in Windows versions, although you may
find the use of the menu more practical.
6
You can get an idea of the functionalities of each of the R packages in the R FAQ
(frequently asked questions) at CRAN.
7
The list of available mirrors can be found at http://cran.r-project.org/mirrors.
html.