O'Reilly logo

Mastering Scientific Computing with R by Radia M. Johnson, Paul Gerrard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading data into R

There are several ways to load data into R. The most common way is to enter data using the read.table() function or one of its derivatives, read.csv() for the .csv files, or read.delim() for .txt files. You can also directly upload Excel data in the .xls or .xlsx format using the gdata or XLConnect package. Other file formats such as Minitab Portable Worksheet (.mtp) and SPSS (.spss) files can also be opened using the foreign package.

To download a package from within R, you can use the install.packages() function as follows:

> install.packages(pkgname.tar.gz, repos = NULL, type = "source" )

Next, load the package (otherwise known as a library) using the library() or require() function. The require() function is designed to use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required