Time for action - issuing your first R command

Time may have escaped you amidst your sudden change in position and hustle in preparing R. Conveniently, R provides us with a simple command to retrieve the current date and time:

  1. In the R console, next to the greater than sign (>), type the following comments and then press the Return (or Enter) key:
    > #use the date() command to get the current date and time
    
  2. Similarly, issue the date() command and press the Return key:
    > date()
    
  3. After issuing the date() command, a message similar to [1] "Sun Aug 31 08:00:00 234" will appear in the R console. In this case, the message indicates that it is 8:00 AM on Sunday, August 31 in the year 234.

Congratulations, you have successfully issued your first R command (and reminded yourself of the current date and time in the process).

What just happened?

As you may have noticed, R commands, or functions, take on a similar form as in other programming languages. In the date() command, for example, the word date specifies the name of the function, while the parentheses () contain the function's arguments. In this case, it was not necessary to use any arguments in the date() command. However, other functions, such as setwd(dir) receive one or more arguments.

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

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