12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

But in many practical situations, you’ll have data that have many differentclasses — in other words, you’ll have a mixture of numeric and character data. Inthis case, you need to use either lists or data frames.If you imagine your data as a single spreadsheet, a data frame is probably agood choice. Remember that a data frame is simply a list of named vectors of thesame length, which is conceptually very similar to a spreadsheet with columns anda column heading for each. If you’re familiar with databases, you can think of adata frame as similar to a single table in a database. Data frames aretremendously useful and, in many cases, will be your first choice of objects forstoring your data.If your data consists of a collection of objects but you can’t represent that asan array or a data frame, then a list is your ideal choice. Because lists can containall kinds of other objects, including other lists or data frames, they’re tremendouslyflexible. Consequently, R has a wide variety of tools to process lists.Table 13-1 contains a summary of these choices.You may find that a data frame is a very suitable choice for most analysisand data-processing tasks. It’s a very convenient way of representing yourdata, and it’s similar to working with database tables. When you read datafrom a comma-separated value (CSV) file with the function read.csv() orread.table(), R puts the results in a data frame.Table 13-1 Useful Objects for Data Analysis

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!