CHAPTER 3

This portion should not be overlooked. The purpose of a helpfile's Examples section is to provide example code that demonstrates how to use a function, beginning with the development of some sample data and then demonstrating how to use the function on the sample data. By copying and pasting the code into the Console and then submitting it, you will learn a lot.We generated an object called “xx” in line 1 of this code, which has the integers -9 to 9 in 1 increments. Another way to make a sequence in R is to use the colon operator (:). Simply type xx and submit it to the R console if you want to look at it.This code, starting on line 2, is typical R helpfile code, which nests many functions together in a short, concise code. Expert coders tend to keep their code as short as possible... it's succinct, simple to understand, and everyone else who uses it won't have to wade through many lines of code to get to the result. As long as you aren't a fledgling, all of this is perfect.In R, a promise is a special form of entity that comes to life when you call it. In the screen shot above, for example, the dataset called ChickWeight has a value of Promise>. This dataset can be accessed by simply typing its name.Consider your site library as a public library where you can "check out" and "return" books. The base library is loaded when you start R, but you must check out functions from a package in your library using the library function. Clicking the check-box in the Packages pane is another way to "check out" an item. R Studio has sent the library feature to the R library.Functions have arguments, some of which have defaults and some of which are optional. We've already mentioned how useful the helpfile and args functions are for learning how to use a function. We've spoken about using 'contributed kits' to add new features to your R base software. In our next chapter, which focuses on objects, we'll expand on this foundation.

Comments

Popular posts from this blog

Blog 1

Blog post 3