O'Reilly logo

Statistical Application Development with R and Python - Second Edition by Prabhanjan Narayanachar Tattar

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

Using utils and the foreign packages

Data is generally available in an external file. The types of external files are certainly varied and it is important to learn which of them may be imported into R. The probable spreadsheet files may exist in a comma separated variable (CSV) format, XLS or XLSX (Microsoft Excel) form, or ODS (OpenOffice/LibreOffice Calc) ones. There are more possible formats but we restrict our attention to these described previously. A snapshot of two files, Employ.dat and SCV.csv, in gedit and MS Excel are given in the following screenshot. The brief characteristics of the two files are summarized in the following list:

  • The first row lists the names of the variables of the dataset
  • Each observation begins on a new line
  • In the ...

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