head, tail, and View functions

You now know a lot about your data, but you still think that you are not seeing it face to face. Fortunately, R comes with three functions able to satisfy even this desire: head, tail, and View. The first two of them are conceived to show you within the console the first and the last n rows of your data, while the third one produces a spreadsheet-like visualization of all of your data frames, which will open in a separate window. Within head and tail, the default number of rows to be shown is equal to five, but you can tune this using the n argument.

As you may be already guessing, to apply the head and tail functions you just have to run them on your object, for instance:

head(customer_list)

This will result in:

 customer_code     commercial_portfolio     business_unit
1 1 less affluent retail_bank
2 2 less affluent retail_bank
3 3 less affluent retail_bank
4 4 less affluent retail_bank
5 5 less affluent retail_bank
6 6 less affluent retail_bank

Running View() on them (be aware of the capital V) will create the following window, or a similar one if not employing RStudio:

Try to apply those three functions to your data before skipping to the next paragraph. This will let you get a good understanding of what the content of the three tables is, helping you to answer the questions we are soon going to face. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset