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.

apply a certain algorithm on a whole set of objects at once. Above all, lists allowyou to write flexible and efficient code in R.Yet, many beginning programmers shy away from lists because they’reoverwhelmed by the possibilities. R allows you to manipulate lists in many differentways, but often it isn’t clear what the best way to perform a certain task is.Very likely, you’ll get into trouble at some point by missing importantdetails, but don’t let that scare you. There are a few simple rules that canprevent much of the pain:If you can name the elements in a list, do so. Working with names alwaysmakes life easier, because you don’t have to remember the order of theelements in the list.If you need to work on a single element, always use either [[]] or $.If you need to select different elements in a list, always use []. Havingnamed elements can definitely help in this case.If you need a list as a result of a command, always use [].If the elements in your list have names, use them!If in doubt, consult the Help files.

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

Saved successfully!

Ooh no, something went wrong!